How to access ItemsSource property of a DataGrid defined in UserControl from main xaml file?
I have declared a DataGrid in UserControl.
Now I have included the UserControl in my main xaml file. I am trying to set the ItemsSource property of DataGrid from main.xaml; but I am getting an error "The property ItemsSource doesnot exist in the namespace".
I am able to set the other properties like Background,Foreground, etc.
My UserControl has this :
<wpfkit:DataGrid Name="DataGrid1"
AutoGenerateColumns="True"
Width="Auto">
</wpfkit:DataGrid>
In main.xaml :
<usercontrol:MultiStepProcessGrid ItemsSource="{Binding GridData}" ></usercontrol:MultiStepProcessGrid>
The above line is giving an error stating that ItemsSource doesnot exist in namespace.
So I wanted to know whether its possible to set 开发者_运维问答the ItemsSource from main.xaml or not!!
Please help me regarding this !!!
Try this
<wpfkit:DataGrid Name="DataGrid1"
ItemSource="{Binding}"
AutoGenerateColumns="True"
Width="Auto">
</wpfkit:DataGrid>
and
<usercontrol:MultiStepProcessGrid DataContext="{Binding GridData}" ></usercontrol:MultiStepProcessGrid>
精彩评论