views:

159

answers:

1

I'd like to have the selected item of a ListBox on the right to look like the selected item of a ListView (with GridView) on the left.

alt text

This is the XAML code:

    <Grid>
    <StackPanel Orientation="Horizontal" >
        <ListView Margin="4" Width="200" >
            <ListView.View>
                <GridView>
                    <GridViewColumn Header="Site" />
                </GridView>
            </ListView.View>
            <ListViewItem>Server Fault</ListViewItem>
            <ListViewItem>Stack Overflow</ListViewItem>
            <ListViewItem>Super User</ListViewItem>
        </ListView>
        <ListBox Margin="4" Width="200">
            <ListBoxItem>Server Fault</ListBoxItem>
            <ListBoxItem>Stack Overflow</ListBoxItem>
            <ListBoxItem>Super User</ListBoxItem>
        </ListBox>
        <Button Margin="4" Content="OK" Width="80" Height="20" />
    </StackPanel>
</Grid>
+2  A: 

Here's a simple article that shows you how to apply a template to the selected item of a list box. Actually getting the look right may be fiddly, but it looks like a border with slightly rounded corners and a vertical gradient, both easy to achieve in XMAL.

Of course you could apply the same template to both lists, that way they will definitely look identical.

Martin Harris
Thank you, this is a good starting point.
ggponti