Binding string Dependency Property to datatemplate
I have a ResourceDictionary define in a different xaml, in it there are data templates that are then used to be set in a Button ContentTemplate like this:
ContentTemplate="{DynamicResource DataTemplateMicroscope}">
I would like to Bind the DynamicResource name string to a parameter or some private member from the CPP code with a Noesis::DependencyProperty* Button3TypeProperty for example.
I was not able to convert a string such "Microscope" to the actual data template to dynamically determine which datatemplate will be used.
Any suggestions?
ContentTemplate="{DynamicResource DataTemplateMicroscope}">
I would like to Bind the DynamicResource name string to a parameter or some private member from the CPP code with a Noesis::DependencyProperty* Button3TypeProperty for example.
I was not able to convert a string such "Microscope" to the actual data template to dynamically determine which datatemplate will be used.
Any suggestions?
-
-
sfernandez
Site Admin
- Posts: 3363
- Joined:
Re: Binding string Dependency Property to datatemplate
Hi, you have two options, use a Binding with a Converter that looks for the data template resource based on the input value and converter parameter, or use a DataTemplateSelector (set in the Button ContentTemplateSelector property) in a similar way. This forum topic is talking about exactly that: viewtopic.php?t=3476
Who is online
Users browsing this forum: No registered users and 5 guests