GridView focus lost when BusyIndicator is not busy

4 posts, 1 answers
  1. Sergey
    Sergey avatar
    23 posts
    Member since:
    Oct 2011

    Posted 06 Nov 2013 Link to this post

    The BusyIndicator content is a control with Gridviiew and MyDetailsViewControl that bound to selected record (in ViewModel)
    When GridView selection changed selected record changed, then BusyIndicator.Busy bound to VM property set to true, then an asynchronous call is made and when it is complete IsBusy set to false.

    Used this (http://www.telerik.com/help/silverlight/radbusyindicator-how-to-restore-the-focus.html) method to return focus to the grid
    (in fact it's a GriidViewCell) with no success.

    Anyone done that?

  2. Answer
    Kalin
    Admin
    Kalin avatar
    1207 posts

    Posted 11 Nov 2013 Link to this post

    Hi Sergey,

    The focus is not going into the Cell as the Cell is not in edit mode. So you will have to set the IsInEditMode property of the GridViewCell to true and Focus it afterwards. Please see the code snippet below which shows how the IsEnabledChanged event handler should be set up:

    private void focusedElement_IsEnabledChanged(object sender, System.Windows.DependencyPropertyChangedEventArgs e)
    {
        (this.focusedElement as GridViewCell).IsInEditMode = true;
        this.focusedElement.Focus();
                 
        this.focusedElement.IsEnabledChanged -= focusedElement_IsEnabledChanged;
    }

    Hope this works.

    Regards,
    Kalin
    Telerik
    TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for SILVERLIGHT.
    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>
  3. DevCraft banner
  4. Sergey
    Sergey avatar
    23 posts
    Member since:
    Oct 2011

    Posted 12 Nov 2013 Link to this post

    Hi Kalin,
    I solved my problem by taking out RadBusyIndicator CONTENT out of it (above in XAML)
    Not sure if there will be any "side effects" - did not notice any so far.

    before
    <RadBusyIndicator>
        <RadGridView\>
    <\RadBusyIndicator>
    after
    <RadGridView\>
    <RadBusyIndicator\>

    I will try your solution when I can.
    Thank you,
    Sergey
  5. Sergey
    Sergey avatar
    23 posts
    Member since:
    Oct 2011

    Posted 12 Nov 2013 Link to this post

    One other thing.
    Setting GridViewCell edit mode might be not a solution.
    In my case the Grid is in read only mode.
    Setting edit mode before setting focus and resetting it back will not set the focus.

    There is another way (that works)

    Find GridView Ancestor (using VisualTreeHelper) and set focus to it.
Back to Top