CanOz Blog

Neil Knobbe's Blog at vbCity

This blog hosted by:
http://blogs.vbcity.com      
  Home :: Syndication  :: Login

MarApril 2008May
SMTWTFS
303112345
6789101112
13141516171819
20212223242526
27282930123
45678910

Archives

Image Galleries

vbCity Blogs

Monday, April 14, 2008 #

After posting up about this feature   of Visual Studio I got to messing around with it a bit. (Sara Ford's post got me excited about this topic)

I got to thinking that although it was a great idea to be about to store code snippets in the toolbox, I did get to thinking that it could get confusing having all sorts of code for different things in one tab and be able to separate the code in organized groups would be handy.  Well guess what.  It can be done.

If you right click on the General tab of the toolbox you can select to add a tab.

A new tab is created and all you need to do is type in the name that you want your tab to have.

Now you can organize your code, and control, snippets so they are easy to find.

posted @ 2:24 AM | Feedback (0)

There are a lot of neat options now available to us programmers thanks to WPF.

One of these is the expander.  The expander is a control pretty much like a groupbox which can hold various controls.  The main difference between a groupbox and an expander is the controls in a groupbox are always visible where the expander gives the developer, and by extension the user, the ability to hide any controls and conserve valuable space on a windows form.

As you can see in the image below, the groupbox and expander both contain two radio buttons.

The advantage of the expander, as I see it, is when I click the little arrow next to the caption of the expander.  Once clicked the expander collapses to the height of its header hiding the controls, in this example the radio buttons, from view. 

I will admit that I had to do a little tinkering with the expander to get it looking and working like I wanted it. 

I dragged and expander from the toolbox onto my window, sized it and set the background colour, then added a stack panel, and within the stack panel, the two radio buttons.

 

This, unfortunately, was not quite what I wanted because the whole background of the expander was light blue and I only wanted the header to be blue with a small border around the controls.

To solve this I had to put a border on the expander before putting the stack panel and the radio buttons.  Setting the background colour of the border to white and adding a margin and padding for the border completed the look I was attempting.

Well it had the look as long as the expander was expanded.  Once I clicked the button to collapse the expander I was left with a blue square.

No radio buttons but not perfect either. 

To get the desired effect of a growing and shrinking panel I used the Expanded and Collapsed methods of the expander to set the height when expanded and collapsed.

Now I have the effect I was after.

Here is the XAML for the expander with the frame, stack panel and two radio buttons.

posted @ 2:08 AM | Feedback (3)