这是 XAML 结构。您将在下面看到我订阅了网格的 Loaded 事件。但是当偶数触发时,this.selectionGrid
它仍然是null
- 即使在随后的布局更新中它仍然是null
,即使我可以看到网格全部填充。
我确实使用了 MEFedMVVM 和 MvvmLight,但我看不出它与这种情况有什么关系。
任何想法为什么?
<Grid x:Name="LayoutRoot" Margin="2">
<toolkit:BusyIndicator IsBusy="{Binding IsBusy}">
<Grid>
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<ContentPresenter
Visibility="{Binding Path=CurrentStep,Converter={StaticResource IntToVisibilityConverter}, ConverterParameter=1}">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition />
</Grid.RowDefinitions>
<TextBlock Text="Select Equipment" Style="{StaticResource HeaderBlockStyle}" />
<ScrollViewer Grid.Row="1">
<sdk:DataGrid x:Name="selectionGrid" GridLinesVisibility="All" AlternatingRowBackground="White" ItemsSource="{Binding Path=AvailableEquipmentView}" AreRowDetailsFrozen="True"
AutoGenerateColumns="False" SelectionMode="Extended" RowDetailsVisibilityMode="Visible" LayoutUpdated="selectionGrid_LayoutUpdated" Loaded="selectionGrid_Loaded" LoadingRowGroup="selectionGrid_LoadingRowGroup">