Quantcast
Channel: Windows Presentation Foundation (WPF) forum
Viewing all articles
Browse latest Browse all 18858

Create dynamic DataGrid with style and properties from an existing datagrid

$
0
0

Hi, in .NET Framework 4.0, C# WPF form, on my UserControl Grid I defined a datagrid 'myDataGrid' with style and some properties.
I did not put any code in the UC Resources block
The 'myDataGrid' is bound to a datatable at runtime.

Now, at runtime I have to generate additional dynamic datagrids that have the same style and properties like the 'myDataGrid'. I can generate dynamic datagrids and bound them to data but their style/properties are not like 'myDatagrid'

<DataGrid Grid.Row="0" Name="myDataGrid" SelectionUnit="CellOrRowHeader" ItemsSource="{Binding}"><DataGrid.RowStyle><Style TargetType="{x:Type DataGridRow}"><Style.Triggers><DataTrigger Binding="{Binding STATUS}" Value="ACTIVE"><Setter Property="Foreground" Value="Green"/></DataTrigger></Style.Triggers></Style></DataGrid.RowStyle></DataGrid>
Thanks,

-sri


sri


Viewing all articles
Browse latest Browse all 18858

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>