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

Selection changes color with loss of focus

Sort Posts: Previous Next
  •  12-07-2010, 8:17 PM Post no. 29393

    Selection changes color with loss of focus

    What do I need to do so that the selected row(s) don't change color when the data grid loses focus?

    I'm using Xceed DataGrid for WPF v3.7.10418.1216.

    Here's an example of the current behavior:

    1) Select one or more rows in the data grid.  Notice that they are displayed with the selection colors.

    2) Take some action that will move the focus from the data grid, for example clicking on the Windows desktop.  The selected rows are repainted and are no longer shown in the selection color.

    3) Take some action that will move the focus back to the data grid without changing the selection, for example clicking on the grid's group by area.  Notice that the selected rows are once again displayed using the selection colors.

    What do I need to do so that the selected row(s) don't change color when the data grid loses focus?  I would like the selected row to be displayed in using the selection colors even when the grid does not have the focus.

    The current behavior is confusing to users, especially when the user right-clicks on a selected row to display the context menu and the selection seems to disappear.

     Any help is greatly appreciated.

    Filed under: , ,
  •  12-08-2010, 2:39 PM Post no. 29405 in reply to 29393

    Re: Selection changes color with loss of focus

    Hi Bryan, 

     In order to achieve this look, you will need to redo the DataTemplate of the DataRow and change the inactiveSelectionBackground brush . 

    However, In order to do that, you need to have access to the blueprind edition in order to redo the template and modify the triggers which change the backgrounds. 

     

    A feature request has been opened a while back to add a flag to force the grid not to use the InactiveSelection look. However, there is no time frame on when this feature would be implemented. 

     In order to have the blueprint edition, you need to contact sales at sales@xceed.com or by phone at 1-800-865-2626 or 450-442-2626

    You can also refer to these forum posts for more information :
    http://xceed.com/CS/forums/post/7417.aspx

    http://xceed.com/CS/forums/thread/18452.aspx

     

    I hope this answers your question :) 

     

     

      

  •  12-16-2010, 2:53 PM Post no. 29494 in reply to 29405

    Re: Selection changes color with loss of focus

    Please do what you can to promote the feature request to add a flag to force the grid not to use the InactiveSelection look.

    We'd like to avoid making our own changes under the hood that would cause us additional work down stream when we want to move to updated versions of the data grid control.

    Thanks.

  •  12-21-2010, 12:24 PM Post no. 29526 in reply to 29494

    Re: Selection changes color with loss of focus

    Hi Bryan, 

    In regards to that feature request, I currently don't have any time-frame on when it will be implemented, you will however be informed through this thread as soon as it is.

    As a workaround, I have forwarded this to the lead developer of the component, and this is what he suggested:

     

    On DataRow there is a property called InactiveSelectionBackground that you can change to what you need. However, this property will not work on all themes because some themes uses a visualtree instead of a brush. The customer will have to redo the template. In the Row Template TableflowView you have this trigger that gives the inactive look the customer is trying to get rid off : 



     <!-- This trigger is used to display the Inactive Selection look -->
            <MultiDataTrigger>
                <MultiDataTrigger.Conditions>

                  <Condition Binding="{Binding RelativeSource={RelativeSource Self},Path=IsSelected}"
                              Value="True" />

                  <Condition Binding="{Binding RelativeSource={RelativeSource Self},Path=(local:DataGridControl.DataGridContext).DataGridControl.IsKeyboardFocusWithin}"
                              Value="False" />

                  <Condition Binding="{Binding RelativeSource={RelativeSource Self},Path=(local:DataGridControl.DataGridContext).DataGridControl.HideSelection}"
                              Value="False" />

                </MultiDataTrigger.Conditions>

                <Setter TargetName="rowBorder"
                        Property="BorderBrush"
                        Value="{StaticResource inactiveSelectionRowBorderBrush}" />

                <Setter TargetName="outerBackground"
                        Property="Background"
                        Value="{StaticResource inactiveSelectionOuterRowBackgroundBrush}" />

                <Setter TargetName="innerBackground"
                        Property="Background"
                        Value="{StaticResource inactiveSelectionInnerRowBackgroundBrush}" />

            </MultiDataTrigger>

    All The client has to do is copy paste the template from C:\Program Files (x86)\Xceed\Xceed DataGrid for WPF Professional Edition v4.1\Themes\Aero\TableflowView.Aero.normalcolor.xaml 

    and remove the trigger mentioned above. If the customer has an issue with missing namespaces, he needs to rename locals: views: markup: to xcdg: .

    I hope this helps!

     


    Best Regards,

    Michel Dahdah
    Technical Support
    Xceed Software inc.
View as RSS news feed in XML
Contact | Site Map | Reviews | Legal Terms of Use | Trademarks | Privacy Statement Copyright 2011 Xceed Software Inc.