jeudi 6 mars 2014

C# WPF ListView of Comboboxes; inform user about SelectionChanged of one of the Comboboxes


Vote count:

0




Thanks for all help in advance!


I have a listview that shows the user a List of ComboBoxes, in which he can choose different units. It looks similar to this:



<ListView.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<TextBlock Name="ChangedIndicator"
Text="#"
Visibility="{Binding DefaultChanged,
Converter={StaticResource BoolToVis}}"/>
<TextBlock Text="{Binding Path=Name}"
Margin="5"
MinWidth="210"
TextAlignment="Center"/>
<ComboBox ItemsSource="{Binding Units}"
DisplayMemberPath="Symbol"
SelectedValue="{Binding DefaultUnit.Key}"
SelectedValuePath="Key"
Name="UserChangesComboBox">
<ComboBox.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<TextBlock Text="{Binding Symbol}"/>
<TextBlock Text=" ("/>
<TextBlock Text="{Binding Key}"/>
<TextBlock Text=")"/>
</StackPanel>
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
</StackPanel>
</DataTemplate>
</ListView.ItemTemplate>


Now, my problem:


As you see, I want to show the user any changes done in the form of a '#' in a textbox next to the Combo. If the user has changed the selection of a certain combobox I want to show the '#'. I'm using the visibilityConverter for this, but thats not the problem.. Basically I want to have a property of Boolean or similar which is true for each combo when SelectionChanged is raised for each of the combos. Or maybe this idea goes into the wrong direction and someone of you can help me out with this..


I want something like this:



(#) Speed -> [m/s]
[km/h]


while the '#' indicates a user change in this combobox! And the [] is basically the combobox with it's two choices..


But the problem is that all comboboxes are objects in an ObservableCollection..


Thanks a lot for any help!



asked 45 secs ago






Aucun commentaire:

Enregistrer un commentaire