Private Sub Button_Click(ByVal sender As Object, ByVal e As RoutedEventArgs) Dim groups As OutlookBarGroupCollection = New OutlookBarGroupCollection() Dim gr As OutlookBarGroup gr = New OutlookBarGroup() gr.Header = "First" groups.Add(gr) gr = New OutlookBarGroup() gr.Header = "Second" groups.Add(gr) groups(0).Key = groups(0).Header.ToString() groups(1).Key = groups(1).Header.ToString() If Not xamOutlookBar1.Groups.ContainsKey("First") Then xamOutlookBar1.Groups.InsertRange(0, groups) groups("First").IsSelected = True Else xamOutlookBar1.Groups.RemoveRange(0, 2) End If End Sub
private void Button_Click(object sender, RoutedEventArgs e) { OutlookBarGroupCollection groups = new OutlookBarGroupCollection(); OutlookBarGroup gr; gr = new OutlookBarGroup(); gr.Header = "First"; groups.Add(gr); gr = new OutlookBarGroup(); gr.Header = "Second"; groups.Add(gr); groups[0].Key = groups[0].Header.ToString(); groups[1].Key = groups[1].Header.ToString(); if (!xamOutlookBar1.Groups.ContainsKey("First")) { xamOutlookBar1.Groups.InsertRange(0, groups); groups["First"].IsSelected = true; } else xamOutlookBar1.Groups.RemoveRange(0, 2); }
Target Platforms: Windows 10, Windows 8.1, Windows 8, Windows 7, Windows Server 2012, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2