Visual 2010 WPF Designer: Styles sometimes shown/not shown?
Ok, I'm pretty new to WPF programming. Now I always run across th开发者_如何学JAVAe following issue so maybe anyone could lighten me up:
In My Window I have a datagrid that I want to style (column should be green). So I create a ressource:
<Window.Resources>
<Style TargetType= "{x:Type DataGridCell}" x:Key="GreenColumns">
<Setter Property="Background" Value="SeaGreen" />
</Style>
</Window.Resources>
Now I have a Column like that:
<DataGridTextColumn Binding="{Binding N}" Header="N" IsReadOnly="True" CellStyle="{StaticResource GreenColumns}">
It is working, no problem at all! Now all I want is to apply this resourced style via the Designer in VS 2010. To do that I click on my DatagridTextColumn. Next I click in "CellStyle" (Property view on the left of course) . In this dropdown there is always a style called "Standard" and sometimes there are self-defined styles too, but not very often. In this case I think I should be able to select my style "GreenColumns". Instead it shows Key: GreenColumns preceeded with a yellow exclamation mark symbol.
I don't get it. What's wrong here? What has to be done in order to show a self-defined style in this dropdown?
I've given up on the Visual Studio XAML designer, even in 2010. There seems to be just too many legitimate techniques that it just cannot handle. I'd say learn XAML code and/or Expression Blend.
精彩评论