Quantcast
Channel: Frans Senden Blog » franssenden
Viewing all articles
Browse latest Browse all 10

ListBox ItemContainerStyle: Getting rid of that boxed restriction

$
0
0

When visualizing data using a listbox and ‘randomly’ place the ListBoxItems (Please read this article for understanding how to do this), you’ll notify that there’s a little friction that makes you consider using an ItemsControl instead: the box that contains your data.   It is default visualized  by a rectangle which contains the ListBoxItem.

A simple solution for this is simply setting the Width and Height property of the ItemContainerStyle:

                <ListBox.ItemContainerStyle>
                    <Style TargetType=”ListBoxItem”>
                        <Setter Property=”Width” Value=”0″/>
                        <Setter Property=”Height” Value=”0″/>
                    </Style>
                </ListBox.ItemContainerStyle>

Although it might be not the most proper solution, it does prevent you from using and customizing the ItemsControl. One of my concerns was to keep all of the selection-functionality from the ListBox Control.



Viewing all articles
Browse latest Browse all 10

Trending Articles