External alias in XAML

后端 未结 2 635
孤城傲影
孤城傲影 2021-01-27 04:22

I\'m currently using a library that implements Menus and ContextMenus for Silverlight 3 and 4. This library d

2条回答
  •  一个人的身影
    2021-01-27 04:44

    I'm afraid the only way around this is to rip the contents of the .g.i.cs file and move it your .cs file, tweak it up with your aliases, remove the partial keyword and then remove the x:Class from the Xaml.

    Upside is the designer will still work. The downside is you need create any new control fields yourself and add the FindName code to the copy of InitializeComponent you now have in your .cs. Personally I quite like this, there are plenty of reasons to give an element a name other than it needing to be a field in the class (binding and animation being two of them). Its annoying that fields are automatically created and precious load time devoted to finding and assigning when they're never used.

提交回复
热议问题