C#C
C#2y 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); }
        }


But thrown an error ResourceReferenceKeyNotFoundException: 'TitleBarButton' resource not found. Help plis
Generic.xaml13.43KB
Was this page helpful?