Back to Devexpress

How to: Iterate Through Available Paint Styles

windowsforms-4883-controls-and-libraries-navigation-controls-navigation-bar-examples-appearance-how-to-iterate-through-available-paint-styles.md

latest1.3 KB
Original Source

How to: Iterate Through Available Paint Styles

  • Nov 13, 2018

The following sample code applies all available paint style to the NavBarControl sequentially. A message box is displayed after each style is applied.

The NavBarControl.AvailableNavBarViews property is used to obtain the list of Views available for the control. Each View is applied to the control via the NavBarControl.View property.

csharp
using DevExpress.XtraNavBar.ViewInfo;
//...
for (int i = 0; i < navBarControl1.AvailableNavBarViews.Count; i++) {
   BaseViewInfoRegistrator vir = 
     navBarControl1.AvailableNavBarViews[i] as BaseViewInfoRegistrator;
   navBarControl1.View = vir;
   MessageBox.Show("The " + vir.ViewName + " painting style.", "Information");
}
vb
Imports DevExpress.XtraNavBar.ViewInfo
'...
Dim I As Integer
For I = 0 To NavBarControl1.AvailableNavBarViews.Count - 1
   Dim vir As BaseViewInfoRegistrator = NavBarControl1.AvailableNavBarViews(I)
   NavBarControl1.View = vir
   MessageBox.Show("The " + vir.ViewName + " painting style.", "Information")
Next