C
C#4mo ago
RV

FindResource not work

I made a WPF Library (Net Framework 4.8) with Generix.xaml (in attach file) and CustomWindow.cs with DependencyProperty like this
public static readonly DependencyProperty TitleBarButtonStyleProperty =
DependencyProperty.Register(nameof(TitleBarButtonStyle), typeof(Style), typeof(CustomWindow),
new PropertyMetadata(Application.Current.FindResource("TitleBarButton")));

public Style TitleBarButtonStyle
{
get { return (Style)GetValue(TitleBarButtonStyleProperty); }
set { SetValue(TitleBarButtonStyleProperty, value); }
}


public static readonly DependencyProperty TitleBarExitButtonStyleProperty =
DependencyProperty.Register(nameof(TitleBarExitButtonStyle), typeof(Style), typeof(CustomWindow),
new PropertyMetadata(Application.Current.FindResource("TitleBarExitButton")));

public Style TitleBarExitButtonStyle
{
get { return (Style)GetValue(TitleBarExitButtonStyleProperty); }
set { SetValue(TitleBarExitButtonStyleProperty, value); }
}
public static readonly DependencyProperty TitleBarButtonStyleProperty =
DependencyProperty.Register(nameof(TitleBarButtonStyle), typeof(Style), typeof(CustomWindow),
new PropertyMetadata(Application.Current.FindResource("TitleBarButton")));

public Style TitleBarButtonStyle
{
get { return (Style)GetValue(TitleBarButtonStyleProperty); }
set { SetValue(TitleBarButtonStyleProperty, value); }
}


public static readonly DependencyProperty TitleBarExitButtonStyleProperty =
DependencyProperty.Register(nameof(TitleBarExitButtonStyle), typeof(Style), typeof(CustomWindow),
new PropertyMetadata(Application.Current.FindResource("TitleBarExitButton")));

public Style TitleBarExitButtonStyle
{
get { return (Style)GetValue(TitleBarExitButtonStyleProperty); }
set { SetValue(TitleBarExitButtonStyleProperty, value); }
}
But thrown an error ResourceReferenceKeyNotFoundException: 'TitleBarButton' resource not found. Help plis
0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server