Hi,
I have a user control with a WPF Data Grid. I used this user control in a Windows form using Element Host.
I can bind the data to the user control using ListCollectionView but when i make updates to the datagrid the changes are not reflected back.
I set the Mode = TwoWay but no use.
Any ideas ?
Here is a sample of my code:
UserControl.xaml
<my:DataGrid ItemsSource="{Binding}"
HorizontalScrollBarVisibility="Hidden" SelectionMode="Extended"
CanUserAddRows="False" CanUserDeleteRows="False"
CanUserResizeRows="False" CanUserSortColumns="False"
AutoGenerateColumns="False"
RowHeaderWidth="20" RowHeight="25" Width="Auto" Height="Auto"
RowStyle="{StaticResource RowSelected1}"
CellStyle="{StaticResource RowSelected}"
GridLinesVisibility="Horizontal" >
<my:DataGrid.GroupStyle>
<GroupStyle ContainerStyle="{StaticResource GroupHeaderStyle1}">
<GroupStyle.Panel>
<ItemsPanelTemplate>
<my:DataGridRowsPresenter/>
</ItemsPanelTemplate>
</GroupStyle.Panel>
</GroupStyle>
</my:DataGrid.GroupStyle>
<my:DataGrid.Columns>
<Controls:LabelTextBoxColumn Header="Tread BarCode" Width="2*"
HorizontalAlignment="Left" VerticalAlignment="Center"
ElementStyle="{StaticResource BaseLabelCellStyle}"
EditingElementStyle="{StaticResource BaseTextBoxCellStyle}"
Binding="{Binding Name,Mode=TwoWay}"/>
The code in my Windows form frm1 is :
this.sdaTrueName.Fill(this.dstrueSrch1.dtTrue);
view = new ListCollectionView(this.dstrueSrch1.dtTrue.ToList());
view.GroupDescriptions.Add(new PropertyGroupDescription("Name"));
UserControlABC.DataContext = view;
I have to save the data back into my database.I am using Dataset and DataTables.
Please help me with any ideas ?