Aliasing Resources (WPF)

后端 未结 2 1004
旧时难觅i
旧时难觅i 2021-01-20 17:10

I am trying to alias a resource in XAML, as follows:



    

        
2条回答
  •  庸人自扰
    2021-01-20 17:50

    I tried using the same setup as Kent and received the following error:

    Property 'Resources' does not support values of type 'System.Windows.Controls.Image'.
    

    I also tried a few other types and got the same thing (only with a different full-qualified type name).

    I was only able to re-key an Image in the in the following way:

    
        
    
    

    I have to wonder: Why? Resources weren't designed to be re-keyed. I have a suspicion that what you are ultimately trying to accomplish could be done better and easier in some other way. Possibly with setters in a style.

提交回复
热议问题