Home Forums WPF controls Xceed DataGrid for WPF Grid lost focus event

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • User (Old forums)
    Member
    Post count: 23064
    #24676 |

    Hello,

    I can’t get the grid lost focus event to fire. Mostly my problem is that when I am on my datagridcontrol and if I click somewhere on the form say a button, my grid’s selected row still remains selected. I don’t get the onselecteditemchanged event either which is registered as follows:

    DependencyPropertyDescriptor SelectedItemChangedDescriptor =
    DependencyPropertyDescriptor.FromProperty(DataGridControl.SelectedItemProperty, typeof(DataGridControl));

    SelectedItemChangedDescriptor.AddValueChanged(element, new EventHandler(OnSelectedItemChanged));

    Is there a way to do this?
    Thanks
    Ranjana

    Imported from legacy forums. Posted by Ranjana (had 586 views)

    Xceed Support
    Member
    Post count: 5658

    LostFocus will be fired only when the grid directly has the logical focus and loses it…

    What I can suggest is using the IsKeyboardFocusWithinChanged event instead…

    In the handler, you can then clear the SelectedItem or SelectedItems properties.

    Imported from legacy forums. Posted by Marcus [Xceed] (had 294 views)

    User (Old forums)
    Member
    Post count: 23064

    Hi Marcus,

    Thanks for the response. In this syntax:

    this.AddHandler(DataGridControl.SomeEvent, new RoutedEventHandler(OnDataGridLostFocus));

    I don’t see a IsKeyboardFocusWithinChanged event but there is a IsKeyboardFocusWithinProperty. Is this what you are referring to?

    Thanks
    Ranjana

    Imported from legacy forums. Posted by Ranjana (had 838 views)

    Xceed Support
    Member
    Post count: 5658

    http://msdn2.microsoft.com/en-us/library/system.windows.uielement.iskeyboardfocuswithinchanged.aspx

    Imported from legacy forums. Posted by Marcus [Xceed] (had 3676 views)

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.