尝试明确定义数据网格列时,我不断收到此错误。如果我注释掉 3 个 datagridtext 列,它可以工作(但我显然想隐藏一些列)。在我的代码中,我所做的只是为 DataGridLookupsTab 设置数据上下文。不要弄乱 itemsource 或我的代码中的任何内容。知道我在这里可能做错了什么吗?
谢谢 !
<TabItem Header="Lookups" Height="23" VerticalAlignment="Top">
<Grid x:Name="DataGridLookupsTab" Background="#FFE5E5E5" Margin="0,0,-1,-2" DataContext="Apps.OMS.Models.Lookups">
<ComboBox x:Name="ComboBoxDistinctLookups" HorizontalAlignment="Left" Margin="128,14,0,0" VerticalAlignment="Top" Width="228" ItemsSource="{Binding Path=LookupTypeList}" SelectionChanged="ComboBoxDistinctLookups_SelectionChanged"/>
<Label Content="Select Lookup Type" HorizontalAlignment="Left" Margin="10,10,0,0" VerticalAlignment="Top" RenderTransformOrigin="1.105,4.731"/>
<DataGrid x:Name="DataGridLookups" HorizontalAlignment="Left" Margin="10,41,0,0" VerticalAlignment="Top" Width="768" Height="327" ItemsSource="{Binding LookupRecords}" >
<DataGridTextColumn Binding="{Binding LookupType}" Header="Lookup Type" />
<DataGridTextColumn Binding="{Binding LookupValue}" Header="Lookup Value" />
<DataGridTextColumn Binding="{Binding LookupDescription}" Header="Lookup Description" />
</DataGrid>
</Grid>
</TabItem>