Monday, March 4, 2013

Infragistics UltraSplitter

For my work, as a Graphical User Interface(GUI) developer, I had to replace the Windows Forms SplitContainer for the Infragistics UltraSplitter. Since there is limited documentation about the UltraSplitter I decided to dedicate a blog post about how to implement a UltraSplitter in Windows Forms.

First of all, before replacing the SplitContainer you have to figure out how it works. Luckily for you Microsoft has extensive documentation about the SplitContainer. See for instance MSDN.

SplitContainer
The SplitContainer is one control which seems to be a collection of four different controls. The SplitContainer itself acts like a container Panel with three controls in it. A left panel, the splitter(blue arrow) and a right panel. However note that it is one control.

I started the replacement with an impact analyse. I figured out that the SplitContainer had a lot of coded dependencies. Lots of functionality was programmed to work with the SplitContainer. Therefore I was forced to build a replica of the SplitContainer, who acts just like how the Windows Forms SplitContainers acts.

UltraSplitter
I started with a sample project to make a proof of concept. In the sample project I made a container panel(the blue panel) and added another panel(Panel1) to it. A very important detail is the docking style of first panel(Panel1). Since I wanted the UltraSplitter to be orientated vertically I docked the first panel left. The second control is the UltraSplitter, also docked left and the third control that is added is another panel (Panel 2). Note that the last panel has to be fully docked.

Voila we have made a mock SplitContainer using the UltraSplitter of Infragistics. Note that there are a couple of functional changes between the SplitContainer and the UltraSplitter. When you resize the entire SplitContainer, the panels keep their relative width or height. They auto-size relatively to the SplitContainer. This is different in the UltraSplitter implementation, the panels don't autosize because they are different controls and are only connected through docking properties.

Here is the code:
*Note that this code is part of a greater project. Therefore it contains prefixes and additional functionality which may seem superfluous for you.


Keywords:
Infragistics, splitter, SplitContainer, UltraSplitter, example, docking, c#, .NET SplitContainer

3 comments:

  1. Thank you that helped very much!!

    ReplyDelete
  2. though the panels are not resizing but when the panel size is reduced than the size of the controls then also no scrollbar appears

    ReplyDelete
    Replies
    1. I suggest to place another panel inside one of the splitter panels. You can use that panel for outlining your controls and hiding or displaying scrollbars. You could use the
      AutoScroll property for instance.

      Delete