1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
|
<Window.Resources>
<ObjectDataProvider x:Key="DataProvider2"
ObjectType="{x:Type local:DataClasse}" MethodName="GetData" d:IsDataSource="true" d:IsDesignTimeCreatable="True">
</ObjectDataProvider>
<CollectionViewSource x:Key="MyList" Source="{StaticResource DataProvider2}" />
...
</Window.Resources>
...
<DataGrid
d:DataContext="{Binding Source={StaticResource MyList}}"
IsSynchronizedWithCurrentItem="{x:Null}" ItemsSource="{Binding Path=., Mode=TwoWay}"
AutoGenerateColumns="False" Height="185" HorizontalAlignment="Left" Name="grdData" VerticalAlignment="Top" Width="665" AlternatingRowBackground="#FFDCDCF5" CanUserAddRows="False" SelectionMode="Single"
IsReadOnly="True"
Margin="0,30,0,0" SelectionChanged="grdData_SelectionChanged">
<DataGrid.Columns>
<DataGridTextColumn Binding="{Binding Path=Data1}" Header="Data1" />
<DataGridTextColumn Binding="{Binding Path=Data2}" Header="Data2" />
...
</DataGrid> |
Partager