in my xaml file I have two identical DataGrids that are bound to different collections, and have different names, and different Grid.Column attributes. Is there a way to not repeat the markup for these data grids but have something more concise? Like a macro substitution in programming languages?
<DataGrid AutoGenerateColumns="False"
CanUserAddRows="False"
ItemsSource="{Binding View0}"
Name="DataGrid0"
SelectedItem="{Binding SelectedTask}"
SelectionMode="Single"
Grid.Column="0"
views:DataGridProperties.RowEditEndingCommand="{Binding UpdateTaskCommand}">
...
</DataGrid>
...
<DataGrid AutoGenerateColumns="False"
CanUserAddRows="False"
ItemsSource="{Binding View1}"
Name="DataGrid1"
SelectedItem="{Binding SelectedTask}"
SelectionMode="Single"
Grid.Column="1"
views:DataGridProperties.RowEditEndingCommand="{Binding UpdateTaskCommand}">
...
</DataGrid>
Use
Stylesfor identical values, that usually takes care of most properties, and if the properties are not identical there usually is no need to go any further.