forum

Home / DeveloperSection / Forums / WPF overrided datagrid how to set DatagridCell Selected style

WPF overrided datagrid how to set DatagridCell Selected style

E E Cummings560119-Jul-2013

I have overrides DataGrid. Below are my code and XAML. How can I set style to change the DataGridCell background colour when the cell is selected?

<vw:DataGridExt

   Grid.Row="1"

   AlternatingRowBackground="LightGray"

   ItemsSource="{Binding RelativeSource={RelativeSource TemplatedParent},Path=Value,Mode=OneWay, IsAsync=True}"

   Background="White"

   AutoGenerateColumns="True"

   IsReadOnly="True"

   CanUserResizeRows="False"

   ClipboardCopyMode="IncludeHeader"

   CanUserSortColumns="True"

   CanUserAddRows="False"

   SelectionMode="Extended"/>                

 public class DataGridExt : DataGrid

 {

     public DataGridExt()

     {

         this.AutoGeneratedColumns += new EventHandler(DataGrid_AutoGeneratedColumns);

     }

 }

thanks in advance


Updated on 19-Jul-2013

Can you answer this question?


Answer

1 Answers

Liked By