If you are working on Silverlight and/or WPF project and using Telerik RadControls library, you might be aware of RadDiagram and RadDiagramToolbox. When you add gallery items in RadDiagramToolbox, by default it comes in three columns.

In some business scenario, you might want to increase or decrease the no. of columns in the RadDiagramToolbox. This small blog post will help you in this.

The default three column toolbox eats a big screen space and sometime just an one or two column is more than sufficient to show to the user. The control directly does not exposes any properties or methods to configure the no. of columns to show but you can surely configure it by editing the template of the RadDiagramToolboxGroup. Here is a screenshot of the basic layout:

If you want to modify the column count in your Telerik’s RadDiagramToolbox, just copy the below code in your XAML page and change the column count appropriately (in our case, we set it to 1 “one”). Let’s understand how this has been implemented.

In the RadDiagramToolboxGroup style, create the ItemsPanel template with a RadUniformGrid control which supports setting the no. of columns. Setting Columns=”x” attribute will set “x” nos. of columns in the RadDiagramToolbox control, where “x” is a numeric positive integer.

Here are two screenshots of the same with number of columns set as 2 (two) and 1 (one) respectively:

I hope, this small trick will allow you to configure the columns in your RadDiagramToolbox control. Not only this, you will be now able to reconfigure it dynamically based on user’s input. That’s your business logic.

Thanks for reading this trick. Drop a line below if that helps. Connect with me on Twitter and Facebook to get the updates on articles and technical stuffs. Cheers.

If you have come this far, it means that you liked what you are reading. Why not reach little more and connect with me directly on Twitter, Facebook, Google+ and LinkedIn. I would love to hear your thoughts and opinions on my articles directly. Also, don't forget to share your views and/or feedback in the comment section below.

About Me

Kunal Chowdhury is a Windows Platform Development MVP of Microsoft, a Telerik MVP, Nokia Developer Champion, Speaker in various Microsoft events, Author, passionate Blogger and a Software Engineer by profession.