How to declare a resource from a private inner class in WPF?

I am trying to declare a resource in WPF UserControl, and I would like this resource to be an instance of a private inner class. How to do it?

XAML:

<UserControl ...> <UserControl.Resources> <local:MyConverter x:Key="MyConverter" /> </UserControl.Resources> </UserControl> 

Code for:

 public partial class MyUserControl : UserControl { private class MyConverter : IValueConverter { // convertion code... } } 
+4
source share
1 answer

You cannot do this if the class is private, you can make it internal instead

Regarding declaring the inner class in XAML, you should watch this discussion

+3
source

Source: https://habr.com/ru/post/1286353/


All Articles