vS 2008 avec la boîte à outils WPF installée et référencée. Dans le Window1.xaml j'ajouté cette ligne:Styles DataGrid
xmlns:my="http://schemas.microsoft.com/wpf/2008/toolkit"
Il fonctionne, la grille affiche des données, jusqu'à ce que je tente de style de la grille. J'obtiens une erreur lorsque j'essaie d'appliquer un style qui centre le texte. L'erreur se réfère à App.xaml et est:
La référence de type ne trouve pas un type public nommé 'DataGridCell'. Ligne 9 Position 75.
Mon App.xaml
<Application x:Class="DataGridStyles.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
StartupUri="Window1.xaml">
<Application.Resources>
<Style x:Key="CenterCellStyle" TargetType="{x:Type DataGridCell}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type DataGridCell}">
<Grid Background="{TemplateBinding Background}">
<ContentPresenter HorizontalAlignment="Center"
VerticalAlignment="Center"/>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
<Style.Triggers>
<Trigger Property="IsSelected" Value="True">
<Setter Property="Background" Value="Transparent" />
<Setter Property="BorderBrush" Value="Transparent" />
<Setter Property="Foreground" Value="Black" />
</Trigger>
</Style.Triggers>
</Style>
</Application.Resources>
</Application>
je suis tombé sur le même problème, s'il vous plaît poster une solution si vous avez trouvé un. –