Programmatically Creating Elements from DataTemplate
Posted: 08 Dec 2013, 19:31
Hi,
I need to generate multiple elements dynamically based on real time data and display them on some kind of host controller - WrapPannel in my example.
Each custom element has it's own name, id and display image which I load and create dynamically.
I created a a data template element and I want to fill the host container with multiple different instances.
1. What will be the best approach for this problem ?
2. How can I create a Frameworkelement based on this DataTemplate on runtime ?
3. How can I use the DataTemplate consept with ItemsControl ? I tried create a DataBinding to ItemsSource as well as adding items manually to the Items attribute but without success.
[EDIT]
I use the native SDK.
I need a quick sample that shows how to bind data to ItemsSource from independent application framework
One more related question to this -
When I create Gui resources dynamically such as TextBlocks, Buttons, etc I'm using the new keyword.
Should I use different allocation mechanism ? Who is in charge to free these elements ? The application code or Noesis SDK ?
I need to generate multiple elements dynamically based on real time data and display them on some kind of host controller - WrapPannel in my example.
Each custom element has it's own name, id and display image which I load and create dynamically.
I created a a data template element and I want to fill the host container with multiple different instances.
1. What will be the best approach for this problem ?
2. How can I create a Frameworkelement based on this DataTemplate on runtime ?
3. How can I use the DataTemplate consept with ItemsControl ? I tried create a DataBinding to ItemsSource as well as adding items manually to the Items attribute but without success.
[EDIT]
I use the native SDK.
I need a quick sample that shows how to bind data to ItemsSource from independent application framework
One more related question to this -
When I create Gui resources dynamically such as TextBlocks, Buttons, etc I'm using the new keyword.
Should I use different allocation mechanism ? Who is in charge to free these elements ? The application code or Noesis SDK ?