'宣言 Public Shadows ReadOnly Default Property Item( _ ByVal key As String _ ) As OutlookBarGroup
public new OutlookBarGroup this[ string key ]; {get;}
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); }