IOT Virtual Conference - Register now to book your ticket and get updates
x
CONGRATULATIONS! C# Corner Q1, 2021 MVPs Announced
Why Join
Become a member
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
C# Corner Home
Technologies
Monthly Leaders
ASK A QUESTION
Forumguidelines
Dharshini
2k
24
22.2k
Binding DataGrid Details to Selected Item in a combobox
Mar 15 2013 7:39 AM
I have a `combobox` and a `datagrid` in my application. The datagrid has its itemsSource from its collectionViewSource resource key(using Entity Framework) and there are three `ComboBoxItem`'s inside the combobox as warning/error/exception as shown in the image-
http://tempuri.org/tempuri.html
How to display the selecteditem row details on the datagrid when the respective `ComboxBoxitem` is selected.
XAML for ComboBox
<ComboBox SelectedItem="{Binding DetailsViewSource.Type}"
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>
XAML for Datagrid
<DataGrid AutoGenerateColumns="False"
Foreground="DarkBlue" EnableRowVirtualization="True" Height="auto"
HorizontalAlignment="Left" ItemsSource="{Binding}" Name="dataGrid1">
Kindly help. Thanks
Reply
Answers (
0
)
Master form in wpf
refresh datagrid items without losing selected row - XAML