How to access a WPF control located in a ControlTemplate? -
Usually, WPF controls are declared in .xaml files and no code behind (.xaml.cs files) In. However, sometimes I need to use some of those controls so that they can be manipulated. How can I handle such a control if it "remains" in the xaml file?
You can use the FindName () method of the ControlTemplate class.
// Control of the grid grid is finding the grid generated by the template = (grid) myButton1.Template.FindName ("grid", MyButton1);
Comments
Post a Comment