Click here to Skip to main content
15,894,017 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a style on my datagrid to disable a DataGridRow based on a property binding. This makes the row unselectable, which is what I want. However, I am still able to select the disabled rows using at least 2 other ways. The first is if I use a dragging motion between two enabled rows that surround the disabled row. The second is if I click on the "select all" button on the top left of the datagrid. Is there a way to make specific rows completely unselectable?

This is what I currently have:

HTML
<datagrid.rowstyle>
    <Style TargetType="{x:Type DataGridRow}">
        <Style.Triggers>
            <datatrigger binding="{Binding DisableMe}" value="True">
                <setter property="IsEnabled" value="False" />
            </datatrigger>
        </Style.Triggers>
    </Style>
</datagrid.rowstyle>
Posted

1 solution

I don't think you can do that with a style.
But you could use the SelectionChanged event to undo the selection.
 
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