I am trying to bind Groups and content items dynamically to a XamOutlookBar NA version 2010v2. All of the examples I am seeing initialize XamOutlookBar.GroupContentTemplate but in version 2010.2 there isn't GroupContentTemplate member. Question is how do I create a data template for the group content in version 2010.2. Thanks.
All expamples rerer to doing this:
<igOB:XamWebOutlookBar.GroupContentTemplate> <DataTemplate> <StackPanel> <TextBlock Text="{Binding Name}"/> <TextBlock Text="{Binding Enabled}"/> <TextBlock Text="{Binding Visible}"/> </StackPanel> </DataTemplate> </igOB:XamWebOutlookBar.GroupContentTemplate>
Hello Andre,
Thank you for your post. I have been looking into it and I created a sample project for you following your scenario and everything seems to work ok on my side. If the sample doesn’t satisfies all your needs feel free to modify it, so it reproduces your behavior and send it back to me for further investigation.
Looking forward for your reply.
Stefan, thanks for quick response but honestly I am not following your sample. I am using WPF and XamOutlookBar control while your project seems to be a Silverlight app. I have managed to figure out the issue I described above using a combination of Style and DataTemplate in control resources. Next question is how do I handle a click on one of the xamMenuItems in my ViewModel? Thanks.
This will bind your XamOutlookBar to a colleciton of Groups/MenuItems
<UserControl.Resources> <DataTemplate x:Key="ItemTemplate"> <ListBox ItemsSource="{Binding}"> <ListBox.Resources> <Style TargetType="{x:Type ListBox}"> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type ListBox}"> <Grid> <ScrollViewer Focusable="False"> <StackPanel Margin="1" IsItemsHost="True"/> </ScrollViewer> </Grid> </ControlTemplate> </Setter.Value> </Setter> </Style> </ListBox.Resources> <ListBox.ItemTemplate> <DataTemplate> <StackPanel Orientation="Horizontal"> <Image Source="{Binding Path=Image}"/> <TextBlock Text="{Binding Path=Text}" Margin="2,3"/> </StackPanel> </DataTemplate> </ListBox.ItemTemplate> </ListBox> </DataTemplate> <Style TargetType="{x:Type igOutlookBar:OutlookBarGroup}"> <Setter Property="Content" Value="{Binding MenuItems}" /> <Setter Property="ContentTemplate" Value="{StaticResource ItemTemplate}" /> <Setter Property="Header" Value="{Binding Path=Title}"/> <Setter Property="LargeImage" Value="{Binding Path=LargeImagePath}"/> <Setter Property="SmallImage" Value="{Binding Path=SmallImagePath}"/> </Style> </UserControl.Resources>
Thank you for your feedback. I am glad that you resolved your issue and I believe that other community members may benefit from this as well.
Thanks again.
Stefan, got the issue resolved following your example posted in the other thread. Thanks for assistance.
I am just checking if you got this worked out or you still require any assistance or clarification on the matter.
Despite this, is it possible for you to send us an isolated sample roject, where the issue is reproduced, so we could be able to investigate this further for you?
I agree this was not posted to the right section. The question was on WPF version of the control.