Hi. I'm evaluating Infragistis WPF stuff. Looks great so far. However, I'm struggling with a feature.
I'm building on the examples for the xamCarouselListBox in xamFeatureBrowser. I want to replace the datatemplate for the listboxitem when an item is selected. But no matter what I do, the selected listbox item will not change. This is really important to me and hopefully someone can tell me where I go wrong. Here's the part of the code that I suppose is significant:
<Style TargetType="{x:Type igWindows:CarouselPanelItem}" x:Key="ContainerStyle"> <Setter Property="ContentTemplate" Value="{StaticResource SimpleDataTemplate}" /> <Style.Triggers> <Trigger Property="IsSelected" Value="True"> <Setter Property="ContentTemplate" Value="{StaticResource SeletedDataTemplate}" /> </Trigger> </Style.Triggers> </Style>
Thanks in advance.Best wishesKai BohliNorway
Hello Kai,
If you want to trigger the selection of the CarouselListBoxItems and give them a different template when selected, you will have to do the following.
First, you will need to Target the CarouselListBoxItem rather then the CarouselPanelItem. Then, Set up dataTriggers to resemble the following.
<Style TargetType="{x:Type igWindows:CarouselListBoxItem}"> <Style.Triggers> <DataTrigger Binding="{Binding RelativeSource={RelativeSource Self},Path=IsSelected}" Value="True"> <Setter Property="ContentTemplate" Value="{StaticResource SelectedDataTemplate}" /> </DataTrigger> <DataTrigger Binding="{Binding RelativeSource={RelativeSource Self},Path=IsSelected}" Value="False"> <Setter Property="ContentTemplate" Value="{StaticResource CLBItemDataTemplate}" /> </DataTrigger> </Style.Triggers> </Style>
Now, when I select an item in the list, it will change templates. I have attached a sample to this post. Please test it at your end to verify it resolves you issue.
Hi Steve. Thanks for your reply. I had given up waiting for an answer and have uninstalled the Ifragistics stuff a while ago. Maybe I'll try it again later. I'm very sceptical about buing coding tools when the vendor's dosen't respond on the newsgroups, even though I know you got other support channels. Forums have always been my primary source for learning coding related stuff and it's a lot harder for me to write a support mail escpecially when I'm just evaluating.
Thanks anyway. If you had not replied, I would have forgotten about Infragistics no matter how cool your WPF stuff are :)
Best wishes
Kai Bohli
Norway