tags:

views:

60

answers:

2

I have a listbox with several items in it. I would like to programmatically insert a separator bar into the list box. Is this possible?

MSDN speaks of a Separator control, but Visual Studio doesn't recognize it when I try to instantiate one.

I'm using Silverlight 4.

+1  A: 

The Separator control you refer to is in WPF and not supported in Silverlight from what I can see in the documentation.

I would handle this via templates. Set up your template with a representation of the item and a second representation of a separator and then bind the visibility of each to a an IsSeparator flag on your data object.

Then all you need to do is set create a dummy object with the IsSeparator flag set to true to get the new item in your list.

James
A: 

see : http://manfredlange.blogspot.com/2009/04/separator-for-menu-item-in-xaml-wpf.html

I use it in silverlight 4, I simply drag & drop from the toolbox and it added me a reference to the toolkit:

xmlns:toolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit"

and I use it this way:

<toolkit:Separator Margin="15"/>
Sam