Dynamic ContentControl > Style > DataTemplate....binding problem!
WPF
1
Posts
1
Posters
0
Views
1
Watching
-
Hi, I have to create some ContentControl code behind and be able to change their content and their DataTemplate according to their data type (image or text) (So, I've created a ContentControl code behind, given it (code-behind too) a style from the XAML. In this style I've set DataTemplates) I'm blocked with a binding problem! The 'person' object is displaying but I can't get to its 'display_text' property! Could you please help? Thanks!! PS: By the way, my goal is to create containers dynamically, then send them a 'person' object and have a picture displayed if available or a text displayed (if image not available)...so, if you have other suggestions on how to achieve this they all are welcome!! ;-)
<Setter Property="ContentTemplate" Value="{StaticResource ccTexte}"/> <!--<Setter Property="ContentTemplate" Value="{StaticResource ccImage}"/> <Style.Triggers> <DataTrigger Binding="{Binding Source={StaticResource display\_image}}" Value="{x:Null}"> <Setter Property="ContentTemplate" Value="{StaticResource ccTexte}"/> </DataTrigger> </Style.Triggers>-->