Home Forums WPF controls Xceed DataGrid for WPF Selected Row Template

Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • User (Old forums)
    Member
    Post count: 23064
    #24311 |

    Component: Xceed Data Grid For WPF v 1.2
    IDE: Visual Studio 2008 Team Edition Beta 2
    OS: Windows XP SP2

    I’ve just started using the datagrid and I notice that when I select a row, the column I clicked on remains white while the rest of the row turns blue. I’d like the entire row to turn blue, because I’ve left ReadOnly set to true for the entire datagrid. I’m in the midst of trying a work around with a Column.CellContentTemplateSelector but if there is an easier way I’d like to know.

    Some suggestions for future versions?

    DataGrid.SelectedRowHighlightColor -> Overridden by Column.SelectedCellHighlightColor
    Column.SelectedCellContentTemplate

    Imported from legacy forums. Posted by Duane (had 1812 views)

    Xceed Support
    Member
    Post count: 5658

    EditTriggers=”None”
    NavigationBehavior=”RowOnly”
    CellEditorDisplayConditions=”None”

    Setting these properties on the grid will work better than ReadOnly and will allow the entire row to be selected.

    Imported from legacy forums. Posted by Jenny [Xceed] (had 975 views)

    User (Old forums)
    Member
    Post count: 23064

    Thank you again!

    Imported from legacy forums. Posted by Duane (had 839 views)

    User (Old forums)
    Member
    Post count: 23064

    As I said above, the solution you provided worked great.

    However, if I did want to change the highlight color or such what would be the proscribed method of doing so?

    Imported from legacy forums. Posted by Duane (had 1396 views)

    Xceed Support
    Member
    Post count: 5658

    SelectionBackground and SelectionForeground properties on Row.

    Imported from legacy forums. Posted by Jenny [Xceed] (had 547 views)

    User (Old forums)
    Member
    Post count: 23064

    …. I’m sorry ….
    how do I access row?

    Imported from legacy forums. Posted by Duane (had 725 views)

    Xceed Support
    Member
    Post count: 5658

    You can create a style for the DataRow type (it derives from Row) and in the style set the SelectionForeground and SelectionBackground properties. For example:

    <code>
    <Style TargetType={x:Type xcdg:DataRow}>
    <Setter Property=”SelectionBackground” Value=”HotPink”/>
    <Setter Property=”SelectionForeground” Value=”White”/>
    </Style>
    </code>

    Imported from legacy forums. Posted by Jenny [Xceed] (had 473 views)

    User (Old forums)
    Member
    Post count: 23064

    Ok, thanks that worked great also!

    Imported from legacy forums. Posted by Duane (had 5905 views)

    User (Old forums)
    Member
    Post count: 23064

    Hi,

      In the row of my grid, some of the cells has different bacl colors depends on the condition. When I select row, the whole row’s back color changes to blue. What in need is when I select row or click on cell, the row back color should not be change or you can say the row should not be selected. only the cell where I click should be selected. Can you please help me to solve.

    Thanks & Regards,

    Mukesh Wadhwa

    Imported from legacy forums. Posted by Mukesh (had 1150 views)

    User (Old forums)
    Member
    Post count: 23064

    Hello Mukesh I think our answer should be similar.
    Hello Jenny. I want to ask why my “SelectionBackground” didn’t work, while the “Background” property works. Here are my codes:

                <xcdg:DataGridControl x:Name=”GridGaji” ItemsSource=”{Binding Karyawans}”>
                    <xcdg:DataGridControl.Resources>
                        <Style TargetType=”{x:Type xcdg:DataRow}”>
                            <Style.Triggers>
                                <DataTrigger Binding=”{Binding Path=IsEdited}” Value=”True”>
                                    <Setter Property=”Background” Value=”Yellow”/>
                                    <Setter Property=”SelectionBackground” Value=”LightYellow”/>
                                </DataTrigger>
                            </Style.Triggers>
                        </Style>
                    </xcdg:DataGridControl.Resources>
                </xcdg:DataGridControl>

    I am using:
    Extended WPF Toolkit 1.9.0.
    Visual Studio 2010
    Net Framework 4.0

    Imported from legacy forums. Posted by Fandi (had 262 views)

    User (Old forums)
    Member
    Post count: 23064

    Solved. The problem is in the AeroTheme. Read the link below for details.

    http://xceed.com/CS/forums/post/24017.aspx

    I replied just so that some people in the future with the same problem could be helped quicker.

    Thanks to Xceed and this forum that make WPF programming somewhat easier. 

    Imported from legacy forums. Posted by Fandi (had 1359 views)

Viewing 11 posts - 1 through 11 (of 11 total)
  • You must be logged in to reply to this topic.