Click here to Skip to main content
15,881,882 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I'm stumbled on this ridiculous problem for a few days now, and would appreciate any bits of wisdom any one has on the matter.
I'm trying to implement a DataGrid with multiple row selection that will set the last selected row (focused row if i may, tho it appears to not be supported by the DataGrid object) to have a different background from the other selected rows and draw a border around it.
I need a virtualizing control, so a ListView is not a viable solution as far as i know.
How would one go about it in WPF? I managed so far only disable the cell selection rectangle...
Thanks in advance!

Edit: In order to further clarify what i'm trying to do i post my latest failed attemp..:

XML
<DataGrid.RowStyle>
    <Style TargetType="{x:Type DataGridRow}">
        <Style.Triggers>
            <MultiTrigger>
                <MultiTrigger.Conditions>
                    <Condition Property="IsSelected" Value="True"/>
                    <Condition Property="IsFocused" Value="True"/>
                </MultiTrigger.Conditions>
                <Setter Property="Background" Value="#FF3399FF"/>                            
                <Setter Property="BorderThickness" Value="1"/>
                <Setter Property="BorderBrush" Value="Black"/>                            
            </MultiTrigger>
            <MultiTrigger>
                <MultiTrigger.Conditions>
                    <Condition Property="IsSelected" Value="True"/>
                    <Condition Property="IsFocused" Value="False"/>
                </MultiTrigger.Conditions>
                <Setter Property="Background" Value="#993399FF"/>
            </MultiTrigger>
        </Style.Triggers>
    </Style>
</DataGrid.RowStyle>


This would work nice if only the row will somehow get focus....
I do wonder why is the IsFocused property even there if DataGridRow don't receive focus?
Posted
Updated 9-Apr-13 5:55am
v3

 
Share this answer
 
Please check this link
http://www.c-sharpcorner.com/uploadfile/nipuntomar/wpf-datagrid-style/[^]
you need to modify some styles as per your requriement
 
Share this answer
 

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900