Click here to Skip to main content
14,635,816 members
Rate this:
Please Sign up or sign in to vote.
See more:
I am presenting a number of items (text only) in a ListView with a GridView of five columns. The background color of each line is bound to a color name reflecting the state of the item. Like this:

<ListView  Name="viewInst"

  Padding="0" Margin="0,10,0,5" 

  HorizontalContentAlignment="Stretch" 

  HorizontalAlignment="Stretch"

  ItemsSource="{Binding guiInstSet}">

  <ListView.View>
    <GridView>
      <GridView.Columns>

        <GridViewColumn Header="Installer" Width="300" >
          <GridViewColumn.CellTemplate>
            <DataTemplate>
              <TextBox Width="200"

                Margin="0" Padding="0,2" BorderThickness="0" 

                Background="{Binding bgcol}" 

                Text="{Binding installerName}" />
            </DataTemplate>
         </GridViewColumn.CellTemplate>
      </GridViewColumn>


... followed by four more similar GridViewColumn definitions.

I would like each item to appear as one line in the table, but between the fields are the column separators, breaking up the line with white space (or rather: The Background of the ListView).

I have searched - with no success yet - for either ways to set the width of this column separator to zero, or (preferably) to set the background color to the same color as the cells on the line. Note that setting a (single) background color for the entire column separator is not what I want; the color changes from line to line.

Any hint about what to search for to make the lines appear as lines, rather than a row of disjunct cells, will be highly appreciated!
Posted

1 solution

Rate this:
Please Sign up or sign in to vote.

Solution 1

I'm not sure, but try this

<datatemplate>
    <border borderthickness="0,0,0,0" background="{Binding bgcol}" borderbrush="{Binding bgcol}">
        <textblock margin="2" text="{Binding installerName}" />
    </border>
</datatemplate>
   
Comments
trønderen 7-Nov-12 10:35am
   
Sorry, that didn't make much difference. At least not on the column separators.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100