为何在渲染后分配ItemsControl项目的DataContext
||
我在XAML中定义了以下ItemsControl:
<UserControl.Resources>
<DataTemplate x:Key=\"myDataTemplate\">
<Grid Margin=\"20\">
<View:MyView Width=\"123\" Height=\"212\"/>
</Grid>
</DataTemplate>
</UserControl.Resources>
<Grid>
<ItemsControl ItemsSource=\"{Binding MyVMs}\" ItemTemplate=\"{StaticResource myDataTemplate}\">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<WrapPanel />
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
</ItemsControl>
</Grid>
并且在呈现所有UI元素之后分配“ 1”的DataContext。我有兴趣知道,为什么会这样?
没有找到相关结果
已邀请:
1 个回复
臂哦