1
上DataGridTemplateColumn我有一個DataGridTemplateColumn
:WPF:於Windows Server 2003/2008
<DataGridTemplateColumn CellStyle="{x:Null}" Width="85" Header="{Extentions:DisplayName Type=Type:StandardClass, PropertyName=ProductKind}">
<DataGridTemplateColumn.CellEditingTemplate>
<DataTemplate>
<ComboBox ItemsSource="{Binding ElementName=viewSourceDataGrid, Path=DataContext.ProductKindCollection}"
DisplayMemberPath="Title" Style="{x:Null}"
SelectedValue="{Binding ProductKind, ValidatesOnDataErrors=True, ValidatesOnExceptions=True, UpdateSourceTrigger=PropertyChanged}" />
</DataTemplate>
</DataGridTemplateColumn.CellEditingTemplate>
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBlock
Text="{Binding ProductKind.Title, ValidatesOnDataErrors=True, ValidatesOnExceptions=True, UpdateSourceTrigger=PropertyChanged}" />
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
而且也嘗試:
<DataGridComboBoxColumn Header="{Extentions:DisplayName Type=Type:StandardClass, PropertyName=ProductKind}"
DisplayMemberPath="Title"
SelectedItemBinding="{Binding ProductKindID, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, NotifyOnValidationError=True,ValidatesOnDataErrors=True}">
<DataGridComboBoxColumn.ElementStyle>
<Style TargetType="{x:Type ComboBox}" BasedOn="{StaticResource EditBaseStyle}">
<Setter Property="ItemsSource" Value="{Binding ElementName=viewSourceDataGrid, Path=DataContext.ProductKindCollection}" />
</Style>
</DataGridComboBoxColumn.ElementStyle>
<DataGridComboBoxColumn.EditingElementStyle>
<Style TargetType="{x:Type ComboBox}" BasedOn="{StaticResource EditBaseStyle}">
<Setter Property="ItemsSource" Value="{Binding ElementName=viewSourceDataGrid, Path=DataContext.ProductKindCollection}" />
</Style>
</DataGridComboBoxColumn.EditingElementStyle>
</DataGridComboBoxColumn>
一切工作在Win 7罰款,但測試了他們的勝利Server 2008和2003上其結果:
我重新感動風格細胞和DataGrid但仍 的(正如你看到的)ComboBox
項目不會出現
,什麼是問題? –
@Anatoliy Nikolaev:剛剛添加 – Mohsen
您是否在其他操作系統下測試過該程序? (Windows XP,Windows 8)。 –