user-controls

vba inputBox: How to tell difference between “cancel” and “OK” with an empty textbox

北城余情 提交于 2020-04-18 05:02:03
问题 A vba inputBox returns an empty string when the cancel button is pressed. When OK is pressed, it returns whatever text is in its textbox. The inputBox's third positional argument is the initial text in its textbox. The default value for this argument is "". In my application, I use an inputBox to ask a user to specify the name for a new record when he clicks an "Add Record" button. If he presses "cancel", no problem: seems he changed his mind about that new record. I exit the sub. However, if

vba inputBox: How to tell difference between “cancel” and “OK” with an empty textbox

风流意气都作罢 提交于 2020-04-18 05:01:06
问题 A vba inputBox returns an empty string when the cancel button is pressed. When OK is pressed, it returns whatever text is in its textbox. The inputBox's third positional argument is the initial text in its textbox. The default value for this argument is "". In my application, I use an inputBox to ask a user to specify the name for a new record when he clicks an "Add Record" button. If he presses "cancel", no problem: seems he changed his mind about that new record. I exit the sub. However, if

How to create a Circular Style ProgressBar

自闭症网瘾萝莉.ら 提交于 2020-04-18 01:45:51
问题 I need help on implementing a circular progress bar like this: How should I implement the Circle to fill by increasing Value property? 回答1: You have a couple of options - the first is to template the ProgressBar control. This turns out to be a little tricky. I wrote a blog post which describes how to use an attached ViewModel to achieve the required effect. The other alternative is to create your own control from scratch. You could do the following: Create a new user control Add new Value,

Problem with binding child controls of a User Control to UC's public property

不打扰是莪最后的温柔 提交于 2020-04-16 04:49:53
问题 I created a UserControl with a public property of my custom class as described below, with the purpose of editing instances of my custom class I attempted to bind a TextBox per below I placed an instance of this UC on my main Form On the main Form, I set the UC's public property in a Button click event This throws an exception immediately after launch, because (since the Button has not yet been pressed on the main Form) the UC's Job type property is null when the Load event is raised. System

Change Datacontext of a UserControl

我的梦境 提交于 2020-03-15 07:36:47
问题 I have to work with a UserControl, that I cannot change. The Datacontext of this UserControl is set to itself in its constructor. public ParameterControl() { Datacontext = this; } The UserControl should be the template of my ListBox-Items. <ListBox> <ListBox.ItemTemplate> <DataTemplate> <parameterControl:ParameterControl DataContext="{Binding ElementName=StepView, Path=Datacontext.SelectedStep}" //this doesn't work </parameterControl:ParameterControl> </DataTemplate> </ListBox.ItemTemplate> <

Change Datacontext of a UserControl

喜夏-厌秋 提交于 2020-03-15 07:36:04
问题 I have to work with a UserControl, that I cannot change. The Datacontext of this UserControl is set to itself in its constructor. public ParameterControl() { Datacontext = this; } The UserControl should be the template of my ListBox-Items. <ListBox> <ListBox.ItemTemplate> <DataTemplate> <parameterControl:ParameterControl DataContext="{Binding ElementName=StepView, Path=Datacontext.SelectedStep}" //this doesn't work </parameterControl:ParameterControl> </DataTemplate> </ListBox.ItemTemplate> <

User Control with custom ItemsSource dependency property

微笑、不失礼 提交于 2020-03-13 07:31:30
问题 I've got a UserControl with an ItemsSource property. As the base UserControl class does not implement ItemsSource, I had to create my own dependency property like this: #region ItemsSource Dependency Property public static readonly DependencyProperty ItemsSourceProperty = DependencyProperty.Register("ItemsSource", typeof(IEnumerable), typeof(MonthViewControl), new PropertyMetadata(OnItemsSourceChanged)); static void OnItemsSourceChanged(DependencyObject obj, DependencyPropertyChangedEventArgs

How to handle user prompt/user intervention during shell script execution

冷暖自知 提交于 2020-03-05 06:08:15
问题 Consider shell scripts which ask user's input to proceed or not[yY/nN] and another script calls all these scripts. I don't want to give Yy input manually. Note: User input is not an argument to a script and it occurs anytime during script execution. Consider 3 shell scripts viz: a.sh, b.sh, c.sh . On execution, scripts prompt: "You want to Proceed[Y/y/N/n]?" Now, Wrapper.sh calls a.sh, b.sh, c.sh and also provides Y/y or N/n input as and when those scripts prompts. I can not pass an argument

How to handle user prompt/user intervention during shell script execution

帅比萌擦擦* 提交于 2020-03-05 06:08:12
问题 Consider shell scripts which ask user's input to proceed or not[yY/nN] and another script calls all these scripts. I don't want to give Yy input manually. Note: User input is not an argument to a script and it occurs anytime during script execution. Consider 3 shell scripts viz: a.sh, b.sh, c.sh . On execution, scripts prompt: "You want to Proceed[Y/y/N/n]?" Now, Wrapper.sh calls a.sh, b.sh, c.sh and also provides Y/y or N/n input as and when those scripts prompts. I can not pass an argument

MVVM-Light Locator Pattern and Reusable UserControl

余生颓废 提交于 2020-02-25 13:44:57
问题 I have an existing Silverlight 4 application that I am attempting to convert to use the locator pattern and the MVVM-Light library. My understanding is that the MvvmLocator class keeps a reference to each view model and allows you to bind the DataContext of each view to an appropriate ViewModel in the locator. My application uses a navigation frame and hence each page in the app is a UserControl that gets loaded into the Content frame. I can see how easy it is to bind each page view to the