'宣言 Public ReadOnly Property OutlookBar As XamOutlookBar
public XamOutlookBar OutlookBar {get;}
Private Sub Button_Click(sender As Object, e As RoutedEventArgs) For Each group As OutlookBarGroup In xamOutlookBar1.Groups If Not group.HasLargeImage AndAlso Not group.IsSelected Then group.LargeImage = New BitmapImage(New Uri("pack://application:,,,/32x32.png")) End If Next End Sub Private Sub Button_Click_1(sender As Object, e As RoutedEventArgs) Dim group As New OutlookBarGroup() group.Header = "New Group" If group.OutlookBar IsNot Nothing Then System.Diagnostics.Debug.WriteLine("OutlookBar: " + group.OutlookBar.Name) Else System.Diagnostics.Debug.WriteLine("OutlookBar is null") End If xamOutlookBar1.Groups.Add(group) If group.OutlookBar IsNot Nothing Then System.Diagnostics.Debug.WriteLine("OutlookBar: " + group.OutlookBar.Name) Else System.Diagnostics.Debug.WriteLine("OutlookBar is null") End If group.IsSelected = True End Sub
private void Button_Click(object sender, RoutedEventArgs e) { foreach (OutlookBarGroup group in xamOutlookBar1.Groups) { if (!group.HasLargeImage && !group.IsSelected) group.LargeImage = new BitmapImage(new Uri("pack://application:,,,/32x32.png")); } } private void Button_Click_1(object sender, RoutedEventArgs e) { OutlookBarGroup group = new OutlookBarGroup(); group.Header = "New Group"; if (group.OutlookBar != null) System.Diagnostics.Debug.WriteLine("OutlookBar: " + group.OutlookBar.Name); else System.Diagnostics.Debug.WriteLine("OutlookBar is null"); xamOutlookBar1.Groups.Add(group); if (group.OutlookBar != null) System.Diagnostics.Debug.WriteLine("OutlookBar: " + group.OutlookBar.Name); else System.Diagnostics.Debug.WriteLine("OutlookBar is null"); group.IsSelected = true; }