开发者

How can I show a "selection highlighting"-rectangle around a column of a Silverlight Grid?

I have a feature matrix implemented with Silverlight's Grid where users need to select a product. How can I indicate selection with a rectangle around the whole selected column?

I开发者_如何学Pythont is easy to put a CheckBox at the bottom of each product's column, but that is too dull. I would have preffered to use SL Toolkit's DataGrid (with built-in row selection), but it cannot be orientated vertically for a feature matrix...

Thanks, Carl


In order to place a rectangle round the contents of a whole column in a Silverlight Grid you simply place the Rectangle as the last child item in the Grid and assign the property Grid.RowSpan on it to the number of rows in the grid and Grid.Column to the column you wish to highlight. E.g.:-

<Grid x:Name="LayoutRoot">
    <Grid.RowDefinitions>
        <!-- Row Definitions (say 4 in this case)-->
    </Grid.RowDefinitions>
    <Grid.ColumnDefinitions>
        <!-- Column definitions -->
    </Grid.ColumnDefinitions>

    <!-- Grid contents -->

    <Rectangle Grid.RowSpan="4" Grid.Column="1" Stroke="Blue" StrokeThickness="1" />

</Grid>

Having said that it would seem to be hard work to manage a Grid to display something data driven like a product matrix. You state that a DataGrid would work for you if it could render "rows" horizontally. Well a ListBox can be styled that way so that is what I'd been inclined to use.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜