Display dynamic list of sizes in XAML (read-only)

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

Best way to do this? The only thing I can think of is to create a ListView using an ItemTemplate. But then the elements are selected, and that is not what I want. If I make a read-only list, it will turn gray. Do not like it.

Does anyone have a better suggestion?

0
source share
2 answers
<ScrollViewer>
    <ItemsControl ItemsSource="{Binding Properties}">
        <ItemsControl.ItemTemplate>
            <StackPanel Orientation="Horizontal">
                <TextBlock Text="{Binding Name}"/>
                <TextBlock Text="{Binding Value}"/>
            </StackPanel>
        </ItemsControl.ItemTemplate>
    </ItemsControl>
</ScrollViewer>

Use Gridfor ItemsControl.ItemsPanelwith SharedSizeGroupif you want all elements to line up well.

+3
source

All Articles