I have a combobox
and a datagrid
in my application. The datagrid has its itemsSource from its collectionViewSource and there are three ComboBoxItem
's in the combobox as warning/error/exception as shown in the image below.
How to display the selecteditem row details on the datagrid when the respective ComboxBoxitem
is selected.
this what I have tried. Combobox - XAML
<ComboBox
SelectedValuePath="{Binding ElementName=dataGrid1,Path=SelectedItem.Type,Mode=OneWay}"
Grid.Column="1" Height="32" HorizontalAlignment="Left" Name="comboBox1" >
<ComboBoxItem Content="Warning"/>
<ComboBoxItem Content="Error"/>
<ComboBoxItem Content="Exception"/>
</ComboBox>
datagrid's XAML
<DataGrid AutoGenerateColumns="False"
IsSynchronizedWithCurrentItem="True" ItemsSource="{Binding}" Name="dataGrid1">
is it possible to achieve this via XAML skipping code behind ? if not other suggestions are also most welcome.
You can make use of DataGrid's Filter,
Refer here for more details : http://msdn.microsoft.com/en-us/library/ff407126.aspx
This is a code sample that may helps you. It shows a Collection View Source, with a filter...
XAML
Code Behind
And filter like this:
Before
After
It is just an example of filtering, but is it with a regular items control.