Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ResourceDictionary Style Error: "type must derive from FrameworkElement or FrameworkContentElement

GridViewColumnHeader inherits FrameworkElement but GridViewColumn doesn't. Does that mean we cannot style the latter in a resource dictionary?

Snippet in Text

<ResourceDictionary 
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">

    <Style TargetType="{x:Type GridViewColumn}">
    </Style>

    <Style TargetType="{x:Type GridViewColumnHeader}">
        <Setter Property="Background" Value="LightBlue"/>
    </Style>

</ResourceDictionary>

Snippet with Error Message

Resource Dictionary Snippet

like image 496
Shaun Luttin Avatar asked Oct 19 '25 03:10

Shaun Luttin


1 Answers

Yes that means exactly what you said. GridViewColumn has no style. Its not an UiElement. However GridViewColumnHeader is one and it supports style.

like image 76
dev hedgehog Avatar answered Oct 21 '25 22:10

dev hedgehog



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!