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

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -