<Custom:DataGrid Grid.Row="1" Background="{x:Null}" x:Name="datagrid"
DataContext="{StaticResource dataSetPartner}"
ItemsSource="{Binding Partner}"....
and
<ObjectDataProvider x:Key="dataSetPartner" MethodName="PartnerStat" ObjectType="{x:Type loc:DataSetCreator}" />
this is great work, but I need to write a code...
my code not is work:
adatagrid.DataContext = null;
datagrid.DataContext = this.Resources["dataSetPartner"];
Binding b = new Binding("DataContext");
b.Source = datagrid;
b.Path = new PropertyPath("Partner");
b.Mode = BindingMode.OneWay;
datagrid.SetBinding(DataGrid.ItemsSourceProperty, b);
why?