itemssource

WPF ComboBox Doesn't Display SelectedItem after one DataTrigger but does for another

你。 提交于 2020-01-13 10:34:09
问题 So I have a combobox I'd like to reuse for multiple sets of data rather than having 3 separate comboboxes. Maybe this is bad and someone can tell me so. I'm open to all ideas and suggestions. I'm just trying to clean up some code and thought one combobox rather than 3 was cleaner. Anyway the ItemsSource and SelectedItem all should change when another ComboBox's value is changed which Raises the Property Changed value for the ComboBox that isn't working. The worst part is when CurSetpoint

WPF ComboBox Doesn't Display SelectedItem after one DataTrigger but does for another

一曲冷凌霜 提交于 2020-01-13 10:34:06
问题 So I have a combobox I'd like to reuse for multiple sets of data rather than having 3 separate comboboxes. Maybe this is bad and someone can tell me so. I'm open to all ideas and suggestions. I'm just trying to clean up some code and thought one combobox rather than 3 was cleaner. Anyway the ItemsSource and SelectedItem all should change when another ComboBox's value is changed which Raises the Property Changed value for the ComboBox that isn't working. The worst part is when CurSetpoint

WPF ComboBox Doesn't Display SelectedItem after one DataTrigger but does for another

不打扰是莪最后的温柔 提交于 2020-01-13 10:33:34
问题 So I have a combobox I'd like to reuse for multiple sets of data rather than having 3 separate comboboxes. Maybe this is bad and someone can tell me so. I'm open to all ideas and suggestions. I'm just trying to clean up some code and thought one combobox rather than 3 was cleaner. Anyway the ItemsSource and SelectedItem all should change when another ComboBox's value is changed which Raises the Property Changed value for the ComboBox that isn't working. The worst part is when CurSetpoint

WPF binding to a collection of ViewModels fails to display as expected

旧城冷巷雨未停 提交于 2020-01-11 07:47:05
问题 My colleague and I have been desperately trying to understand why we can't get a collection of ViewModels to render as expected. We have created a very simple example that demonstrates the issue. Basically, we have a StupidPerson class that has a Name and a List of friends (also StupidPerson's). In the MainViewModel we create the root StupidPerson and add to his friends four other StupidPerson's. The MainWindow simply displays the source StupidPerson using the StupidPersonViewModel. The

WPF controls, disable changes to `SelectedItem` when bound property to `ItemsSource` changes

一笑奈何 提交于 2020-01-07 04:07:10
问题 When I use ComboBox or other controls that have ItemsSource and SelectedItem property bindings then each time upon the initial binding during runtime and also each time when the bound collection to ItemsSource changes I experience that the content of bound SelectedItem object is changed. How can I disable this? For example: I have <ComboBox MinWidth="300" ItemsSource="{Binding AvailableMasters}" SelectedItem="{Binding SelectedMaster}"> When I run the application the SelectedMaster property is

WPF ItemsSource works in code-behind but not in XAML

杀马特。学长 韩版系。学妹 提交于 2020-01-04 14:04:55
问题 I have a simple combobox with a checkbox inside as such: <ComboBox Height="23" HorizontalAlignment="Left" Margin="158,180,0,0" Name="comboBox1" VerticalAlignment="Top" Width="120" ItemsSource="{Binding collection}"> <ComboBox.ItemTemplate> <DataTemplate> <StackPanel Orientation="Horizontal"> <CheckBox Content="{Binding Name}"></CheckBox> </StackPanel> </DataTemplate> </ComboBox.ItemTemplate> </ComboBox> The datacontext is simply the code behind, and to test it I use the following code: public

WPF ItemsSource works in code-behind but not in XAML

对着背影说爱祢 提交于 2020-01-04 14:03:04
问题 I have a simple combobox with a checkbox inside as such: <ComboBox Height="23" HorizontalAlignment="Left" Margin="158,180,0,0" Name="comboBox1" VerticalAlignment="Top" Width="120" ItemsSource="{Binding collection}"> <ComboBox.ItemTemplate> <DataTemplate> <StackPanel Orientation="Horizontal"> <CheckBox Content="{Binding Name}"></CheckBox> </StackPanel> </DataTemplate> </ComboBox.ItemTemplate> </ComboBox> The datacontext is simply the code behind, and to test it I use the following code: public

Add Element By Element to ListView Without blocking UI

天大地大妈咪最大 提交于 2020-01-03 05:57:11
问题 I am developing a Wpf application which retrieves the data from a database using EF. I have some ListView controls which are filled with some tables of the database so in order to prevent from blocking the UI while retrieving the data I do as follows: Task tsk = Task.Factory.StartNew(() => { ItemsSource = Database.SomeTable(); }); The ItemsSource variable is an ObservableCollection which is bound to the ItemsSource property of a ListView. The thing is that, as expected, while loading the data

Set ItemsSource of Control to another control's ItemsSource that is Static and set in Xaml

你。 提交于 2020-01-01 06:15:48
问题 I am building a UWP Windows 10 App. In a Page I have a FlipView that has static items. Instead of binding them to an ItemsSource, it was easier to set them in Xaml as: <FlipView x:Name="myFlipView"> <FlipViewItem>...</FlipViewItem> <FlipViewItem>...</FlipViewItem> </FlipView> I want to add an Indicators Control to this FlipView as in this tutorial: http://blog.jerrynixon.com/2014/04/lets-code-build-your-own-flipview-page.html When I want to set the ItemsSource of my <ItemsControl x:Name=

Set ItemsSource of Control to another control's ItemsSource that is Static and set in Xaml

喜你入骨 提交于 2020-01-01 06:15:40
问题 I am building a UWP Windows 10 App. In a Page I have a FlipView that has static items. Instead of binding them to an ItemsSource, it was easier to set them in Xaml as: <FlipView x:Name="myFlipView"> <FlipViewItem>...</FlipViewItem> <FlipViewItem>...</FlipViewItem> </FlipView> I want to add an Indicators Control to this FlipView as in this tutorial: http://blog.jerrynixon.com/2014/04/lets-code-build-your-own-flipview-page.html When I want to set the ItemsSource of my <ItemsControl x:Name=