Hello!
Im trying to create CustomGridView component by creating WPF CustomControl (control inherits telerik RadGridView). I realized that my custom control style is not loaded. I made simple example about this problem. Example should change my custom control background to blue but it does not.
my cs. file
and here is my Generic.xaml in themes folder
So basically this is classic start for WPF custom control, but in runtime this is not working. Am I missing something ?
Best regards
Im trying to create CustomGridView component by creating WPF CustomControl (control inherits telerik RadGridView). I realized that my custom control style is not loaded. I made simple example about this problem. Example should change my custom control background to blue but it does not.
my cs. file
public class MyCustomGridView : RadGridView
{
static MyCustomGridView()
{
DefaultStyleKeyProperty.OverrideMetadata(typeof(MyCustomGridView), new FrameworkPropertyMetadata(typeof(MyCustomGridView)));
}
protected override void OnInitialized(EventArgs e)
{
base.OnInitialized(e);
}
}
and here is my Generic.xaml in themes folder
<Style TargetType="{x:Type local:MyCustomGridView}">
<Setter Property="Background" Value="Blue"></Setter>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type local:MyCustomGridView}">
<Border Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}">
</Border>
</ControlTemplate>
</Setter.Value>
</Setter> </Style>
So basically this is classic start for WPF custom control, but in runtime this is not working. Am I missing something ?
Best regards