Tuesday 23 November 2010

Telerik RadCommandBar gets Load and Save Layout functionality

Those people over at Telerik have recently released the new Q3 Version for WinForms. In it there's some quite funky stuff as well as a whole new control called the RadCommandBar.

The RadCommandBar is the toolbar replacement for the RadToolStrip and has some additional features. But the one I'm looking at here is the ability to Load and Save the layout.

As the RadCommandBar allows a user to add and remove the items on the RadCommandBar (just like a Microsoft Office toolbar for example) and grab the ToolStrip rows and re-arrange them, you may want to save these preferences so that the next time the user launches your form, all the layout preferences of the RadCommandBar are as they left them.

Even though the RadCommandBar is new to the Telerik suite of WinForms controls, the documentation is pretty good, though this little documented feature is a real gem and very easy to use.

So, let's say you want to load the layout of a RadCommandBar on launching your form, simply write in the Form Load event

If My.Computer.FileSystem.FileExists("C:\MyCommandBar.xml") Then
          Me.RadCommandBar1.CommandBarElement.LoadLayout("C:\MyCommandBar.xml")
End If


Then when you close the form for exmaple:

Me.RadCommandBar1.CommandBarElement.SaveLayout("C:\MyCommandBar.xml")


It couldn't be much easier. Take a look at the overall feature of the RadCommandBar here.

No comments:

Post a Comment