Version

Add Content to a Group

The OutlookBarGroup object derives from HeaderedContentControl; therefore, using it will be similar to any headered content control found in Microsoft® Windows® Presentation Foundation. Just like any content control in Windows Presentation Foundation, you can set the Content property of a group to an instance of an object. In many cases, you will use a layout container, such as a Grid panel, as the root element — adding additional elements to the layout container.

The following example code demonstrates how to add items to a group. The procedural code assumes that you have already added an OutlookBarGroup object with the key "group1" to xamOutlookBar™.

xamOutlookBar Add Content to a Group 01.png

In XAML:

<igOutlookBar:OutlookBarGroup Header="Group 1" Key="group1">
    <StackPanel>
        <Button Content="Item 1" Margin="5" />
        <Button Content="Item 2" Margin="5" />
    </StackPanel>
</igOutlookBar:OutlookBarGroup>

In Visual Basic:

Dim stackPanel1 As New StackPanel()
Me.xamOutlookBar1.Groups("group1").Content = stackPanel1
Dim button1 As New Button() With { .Content = "Item 1", .Margin = New Thickness(5) }
Dim button2 As New Button() With { .Content = "Item 2", .Margin = New Thickness(5) }
stackPanel1.Children.Add(button1)
stackPanel1.Children.Add(button2)

In C#:

StackPanel stackPanel1 = new StackPanel();
this.xamOutlookBar1.Groups["group1"].Content = stackPanel1;
Button button1 = new Button()
{
    Content = "Item 1",
    Margin = new Thickness(5)
};
Button button2 = new Button()
{
    Content = "Item 2",
    Margin = new Thickness(5)
};
stackPanel1.Children.Add(button1);
stackPanel1.Children.Add(button2);