开发者

ControlTemplate.Resources in a code-behind file

开发者 https://www.devze.com 2023-01-17 07:22 出处:网络
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?

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

精彩评论

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