![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
| |
| | #1 (permalink) |
| | ListView column backgrounds All - I want to have a different background for a specific column in ListView. For instance a sorted column's background / a third column's background etc) I tried to specify a CellTemplate on the GridViewColumn node, but i have run into problems: Ex: <GridViewColumn Header="MySpecialColumn" > <GridViewColumn.CellTemplate> <DataTemplate> <Grid Background="Orange" HorizontalAlignment="Stretch"> <TextBlock Padding="2" Text="{Binding XPath=@Subject}"/> </Grid> </DataTemplate> </GridViewColumn.CellTemplate> </GridViewColumn> Q1: I am not specifying the width of the GridViewColumn explicitly (so the column will size to fit the content). Hence the cell background for each row fits the content background only. For instance the 1st row of my target column has text as "hi" and the second row has "World" - the background "Orange" is getting applied only for the length of the text (hence its short for hi and a bit long for "World".) This is inspite of setting HorizontalAlignment to stretch for the Grid. How to make the grid width span the entire GridViewColumn width? Q2: I tried to set a dynamic binding of the width of the Grid to the width of the GridViewColumn. How to specify the binding here? I am not able to use RelativeSource - FindAncestor - since GridViewColumn is not on the visual tree of the grid. TemplatedParent gives me the ListView which i dont want. So - from the UIElement "Grid" inside the DataTemplate node - how to reference a property of "GridViewColumn" like Width for binding? Please note that the binding worked with specifying ElementName and explicitly specifying a name for the GridViewColumn - but i dont want to do this. Thanks in advance. Regardz Grafix. |
My System Specs![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| Re: backgrounds | Vista file management | |||
| Is it possible in "computer" to view files from top to bottom in 1st column then same again in next column to the right etc? | Vista file management | |||
| different backgrounds | Vista General | |||
| BACKGROUNDS | Vista General | |||