0
這裏是XAML結構。您會在下面看到我正在訂閱網格的Loaded事件。但是,即使發生火災,this.selectionGrid
仍然是null
- 即使在隨後的佈局更新中,它仍然是null
,即使我可以看到網格全部填充。在ChildWindow中加載事件後,Silverlight DataGrid爲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">
的問題:你是否缺少一些XAML?爲什麼BusyIndicator內的內容?爲什麼在ContentPresenter中定義內容 –
是的,我的XAML非常龐大 - 我只想給出一個結構感。將控件放在BusyIndicator中是我經常做的事情,當您設置IsBusy時,所有的子控件都被禁用 - 這有所幫助。它在一個ContentPresenter中,因爲我有幾個不同的視圖,我將在嚮導類型場景中提出,因爲您可能會在那裏觀察可見性綁定。 –
BusyIndicator的標準行爲是「禁用」項目。只需將它放在xaml的末尾,不需要在其中放入項目。看到我對這個問題的回答http://stackoverflow.com/questions/9012870/silverlight-busyindicator/9014486#9014486。這不是ContentPresenter打算使用的方式。它們旨在呈現來自其內容屬性的內容。 –