In my previous article "Exploring Ribbon Control for Silverlight (Part - 1)", we discussed about the Ribbon control Library provided by Devcomponents. We created a small demo application, where we integrated the Ribbon control bar in the XAML.
In this article, we will discuss more on the Ribbon control items. It will be helpful for you to understand them in depth and use it in your application. Read the complete post and at the end, let me know your feedbacks.
To understand this article, you must read my previous chapter "Exploring Ribbon Control for Silverlight (Part - 1)". That will give you more visibility to this library. This control library is not a free one. So, if you are running in it's trial mode, you may get "Invalid LicenseKey" message on top of the control.
The DotNetBar includes Office 2010 style Ribbon control with blue, silver, black and custom color scheme blending based on single color. It supports MVVM as well as 100% code based control creation and setup. You can download the trial version of the library from DevComponents site. Here is the link of the download page: DotNetBar for Silverlight
In this article, we will discuss about Layout Controls.
The LayoutControl is used to perform the customized layouting of controls inside the RibbonBar. It inherits from ItemsHostControl and displays all types of UIElement. Layout controls arranges the items according to the Layout Definition. By default it arranges all the child controls side by side which you can override and mention how your controls will arrange them in that particular area.
Let's start with our existing application. Add a new Ribbon Bar and label it as "Font" where we will create one drop down to load the Font names. In this article, we will not create any font list there. We will just put a place holder for you to understand how this layout works. We will also add a dropdown where we will place various font sizes. Here you will understand how to create a gallery of options like Office 2010. We will also discuss to create additional toggle buttons in the ribbon bar.
Add a LayoutControl element just inside your RibbonBar labeled "Font". Now add a ComboBox from the ribbon library. We will use the ComboBox from the ribbon library to get the additional advantages from the library.
Your XAML will look as below:
There you will bind your items and collection as per your requirement. Now add one more combobox from the library itself to load the font size. Inside the combo box, add a GalleryCategory which will load all the font sizes as a Gallery Item. Give the size of the font as a Content to the GalleryItem.
Look into the following XAML code for better visibility:
We will also add three buttons there named Bold, Italic and Underline. These buttons will be ToggleButton from the Ribbon library itself to get the additional benefits like image source, Tooltip Header, Tooltip Content etc.
See the above XAML code for the reference. You will see how I added the properties there. It has many more properties. Chose the best which is require for you in your application.
Let's run our application. You will see that it now has a ribbon panel named "Font". This is nothing but your layout control. It has two combo box. Clicking on the font size combo will expand the dropdown, from there you can chose the correct font size.
Also, you will see three toggle buttons as we added there, just below the two dropdowns.
This is all about the layout control for this article. There are many more options there. If you want to use it, read the full article from the DevComponents DotNetBar tutorials section. You will see many more features in this Ribbon control for Silverlight.
This is not a FREE control library. You can download the trial version of this library and explore it. In trial mode, it will show a "Invalid LicenseKey" message on top of the Ribbon control. The sample created here uses the licensed version of the library.
If you are interested to get a FREE license of the same, let me know. I will try to do a Giveaway of the library license for my blog readers and twitter followers. Stay tuned for the other news coming shortly.