Welcome to the Xceed Community | Help
Community Search  
More Search Options

DataRow SelectionBackground and InactiveSelectionBackground

Sort Posts: Previous Next
  •  09-17-2009, 2:33 PM Post no. 24017

    DataRow SelectionBackground and InactiveSelectionBackground

    Hi,

    I would like to change the  backGround of the row when the mouse is over it using MouseEnter and Mouse Leave events, but it does not seems to work :

    <Style TargetType="{x:Type xcdg:DataRow}">

        <EventSetter Event="MouseEnter"

            Handler="DataRowMouseEnter"/>

        <EventSetter Event="MouseLeave"

            Handler="DataRowMouseLeave"/>

    </Style> 

    C# code:

    void DataRowMouseEnter(object sender, MouseEventArgs e)

    {

    Xceed.Wpf.DataGrid.DataRow dataRow = sender as Xceed.Wpf.DataGrid.DataRow;

        lastBrush = dataRow.Background;

        dataRow.Background = Brushes.Orange;

    }

    void DataRowMouseLeave(object sender, MouseEventArgs e)

    {

        Xceed.Wpf.DataGrid.DataRow dataRow = sender as Xceed.Wpf.DataGrid.DataRow;

        dataRow.Background = lastBrush;

    }

    I would also like to change the default row color when the when the row is selected and when the selected row looses the focus by using the code below, but is does not work :

    <Grid.Resources>

    <Style TargetType="{x:Type xcdg:DataRow}">

    <Setter Property="InactiveSelectionBackground" Value="Orange" />

    <Setter Property="SelectionBackground" Value="Red" />

    </Style>

    </Grid.Resources>

    <xcdg:DataGridControl Grid.Row="1" Margin="66,40,66,62" Name="dataGridControl1">

      <xcdg:DataGridControl.Columns>

        <xcdg:Column FieldName="ColumnA" Title="ColumnA" />

        <xcdg:Column FieldName="ColumnB" Title="ColumnB" />

      </xcdg:DataGridControl.Columns>

    <xcdg:DataGridControl.View>

      <xcdg:TableView HorizontalGridLineThickness="1" VerticalGridLineThickness="1">

        <xcdg:TableView.Theme>

          <xcdg:AeroNormalColorTheme />

        </xcdg:TableView.Theme>

      <xcdg:TableView.Footers>

    <DataTemplate>

      <xcdg:InsertionRow/>

        </DataTemplate>

          </xcdg:TableView.Footers>

        </xcdg:TableView>

      </xcdg:DataGridControl.View>

    </xcdg:DataGridControl>

    Could you please help me to solve the issues above ? My code seems to have no effect in the application. 

     

    Thanks

    Rafael

     

  •  09-18-2009, 1:07 AM Post no. 24020 in reply to 24017

    Re: DataRow SelectionBackground and InactiveSelectionBackground

    Hello,

     Rafael

    It seems that the problem is with the theme "<xcdg:AeroNormalColorTheme />" and it does not allows us to overide the default style of the theme. I tried using the other theme and it worked fine but using the above theme it is not working.

     

    Thanks,

    Paras Sanghani


    Nothing Is Impossible
  •  09-18-2009, 11:41 AM Post no. 24029 in reply to 24020

    Re: DataRow SelectionBackground and InactiveSelectionBackground

    thanks paras
View as RSS news feed in XML
Contact | Site Map | Reviews | Legal Terms of Use | Trademarks | Privacy Statement Copyright 2011 Xceed Software Inc.