开发者

ControlTemplate.Resources in a code-behind file

How can I get a name开发者_JS百科d resource from ControlTemplate in a code-behind file (*.xaml.cs)? TryFindResource returns null. Template property of the control is also null. What else should I try? Thanks.


Are you using custom control? If yes, you can override OnApplyTemplate method in custom control and can use Template.Find("name of resource") then expose it as a property from the control.

if No, then use custom control.

Hope it helps!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜