tags:

views:

136

answers:

2

Hi,

I want to show a list of "properties" in my application. A property is simply a name/value pair. The number of properties is dynamic.

The best way to do this? The only thing I can come up with is creating a ListView with an ItemTemplate. But then the items are selectable, and that's not what I want. If I make the list read-only, it becomes gray. Don't like that either.

Anyone has a better suggestion?

+3  A: 
<ScrollViewer>
    <ItemsControl ItemsSource="{Binding Properties}">
        <ItemsControl.ItemTemplate>
            <StackPanel Orientation="Horizontal">
                <TextBlock Text="{Binding Name}"/>
                <TextBlock Text="{Binding Value}"/>
            </StackPanel>
        </ItemsControl.ItemTemplate>
    </ItemsControl>
</ScrollViewer>

Use a Grid for ItemsControl.ItemsPanel with SharedSizeGroup if you want all items to line up nicely.

HTH, Kent

Kent Boogaart
A: 

Look here: http://www.codeplex.com/wpg or here http://dvuyka.spaces.live.com/blog/cns!305B02907E9BE19A!448.entry

They are both implmentations of PropertyGrid from WinForms

Timotei Dolean