How to Create WPF Navigation Pane Items Using Code
Categories: DotNetBar for WPF
C#:
// Create new navigation item PaneItem item = new PaneItem(); item.Header = "Item Text"; // Assing the image to item.Image and item.ImageSmall // Assign content to the item DockPanel panel = new DockPanel(); panel.Background = Brushes.Yellow; // Add some content to panel.Children collection panel.Children.Add(new CheckBox()); // Assign panel to the navigation item item.Content = panel; // Add item to NavigationPane controls navigationPane1.Items.Add(item);
VB:
' Create new navigation item Dim item As New PaneItem() item.Header = "Item Text" ' Assing the image to item.Image and item.ImageSmall ' Assign content to the item Dim panel As New DockPanel() panel.Background = Brushes.Yellow ' Add some content to panel.Children collection panel.Children.Add(New CheckBox()) ' Assign panel to the navigation item item.Content = panel ' Add item to NavigationPane controls navigationPane1.Items.Add(item)
Related posts:
- How to create Backstage application menu in DotNetBar for WPF Ribbon Control
- How to Create WPF Docking Windows Using Code Only
- How to do MVVM with WPF Navigation Pane
- How to Access and Change WPF-Ribbon Window Title Text Alignment
- How to re-use the brushes and colors used by Ribbon and other WPF controls
Leave a Reply!