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!
精彩评论