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,
I am just checking the progress of this issue and was wondering if you managed to achieve your goal or if you need any further assistance on the matter.
Since the forum was posted on the Silverlight section I thought you were using Silverlight’s XamOutlookBar, which has a GroupContentTemplate Property. As for your new question, it seems like that I am missing something in your scenario, so could you please send an isolated sample project and more details about the functionality you want to achieve, so I can investigate it further for you.
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 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.