wpf 4 datagrid not highlighting row.

Posted by SteveCav on Stack Overflow See other posts from Stack Overflow or by SteveCav
Published on 2010-06-01T06:21:12Z Indexed on 2010/06/01 6:23 UTC
Read the original article Hit count: 244

Filed under:
|

I have a shiny new wpf 4 datagrid, and no matter what I do I can't make the row highlight when the user clicks on a cell. It works on the empty "new record" row on the bottom, but not on rows with data (yes I've tried with and without readonly).

My XAML is:

        <DataGrid AutoGenerateColumns="False" Background="Beige"  Height="353" SelectionUnit="FullRow" SelectionMode="Single" AlternatingRowBackground="lightcyan"  HorizontalAlignment="Left" Name="dgJobs" VerticalAlignment="Top" Width="1160">
        <DataGrid.Columns>
            <DataGridTextColumn Header="Job ID" Width="80" Binding="{Binding JobID}" IsReadOnly="True"></DataGridTextColumn>
            <DataGridTextColumn Header="Site" Width="SizeToCells" Binding="{Binding AssetName}" IsReadOnly="True"></DataGridTextColumn>
            <DataGridTextColumn Header="Category" Width="SizeToCells" Binding="{Binding CategoryName}" IsReadOnly="True"></DataGridTextColumn>
            <DataGridTextColumn Header="Status" Width="SizeToCells" Binding="{Binding JobStatusDesc}" IsReadOnly="True"></DataGridTextColumn>
            <DataGridTextColumn Header="Reason" Width="SizeToCells" Binding="{Binding Reason}" IsReadOnly="True"></DataGridTextColumn>
        </DataGrid.Columns>
        </DataGrid>

Nothing too fancy, it's quite plain really. I had themes enabled because I'm using a Fluent Ribbon elsewhere and it forces you to, but I tried turning that off and it had no effect.

I have a 3.5 form in another app which is also very plain and you can highlight the row on it. Why on earth isn't this one working?

© Stack Overflow or respective owner

Related posts about wpf

Related posts about datagrid