I have DataTemplate behind which some code is required This template contains ListBox with attribute x: name = "myListBox" . This template is located in ResourceDictionary , which contains the attribute x: Class = "MyNamespace.MyClass" . How can I get the MyClass from the myListBox example code?
try it
ContentPresenter contentPresenter = FindVisualChild & lt; ContentPresenter & gt; (MyListBox); DataDataDate your templatetemplate = contentPresenter.ContentTemplate; Text box txtName = yourDataTemplate.FindName ("vidList", content presentation) as text box; If (txtName! = Null) {// do something with txtNamehere}
No comments:
Post a Comment