c# - WPF - Create a UI object from a DataTemplate -
This is similar to what I asked before. I'm hoping to be clear and get a different answser.
I have a data object (called MockUI). There is a data template (in app.xaml):
& lt; DataTimeplate DataType = "{x: Type Local: MockWI}" & gt; & Lt; Button content = "{binding name}" /> & Lt; / DataTemplate & gt;
In my code, I want to create a UI object that is a data template, I have makevvi and I want to find out which template is used. And the object that is created (in this case a button with the material set on my maskie)
I have just tried to create a button:
button myButton = new button {content = myMockWI}
but like That you might guess, which creates a button, then puts another button inside that button (because the data template is applicable). How do I get a button?
It is turned on that i need to go up the UI tree bit.
If I control a new content, then it does not appear and it takes whatever data applet is.
Then my code changes from:
ContentControl myControl = new content control {content = myMockWI};
Comments
Post a Comment