Creating an instance of a nested class in XAML

后端 未结 3 957
攒了一身酷
攒了一身酷 2020-11-27 17:37

in a XAML file (a WPF UserControl), is there a way to reference an inner class \"B\" defined in another class \"A\" ?

publi         


        
3条回答
  •  失恋的感觉
    2020-11-27 18:24

    This question is pretty old, and I don't know if it would have worked with the version of WPF back in 2010, but now you can make it work by using the "real" (internal) name of the nested type:

    
    

    If you've ever looked a disassembled code, that's how nested types look like:

    ParentTypeName+Nested
    

提交回复
热议问题