Floating RadPaneGroup with RadGridView is stealing focus

2 posts, 0 answers
  1. Ulrich
    Ulrich avatar
    10 posts
    Member since:
    Jul 2011

    Posted 21 Aug 2012 Link to this post


    In a RadPaneGroup with a RadGridView we are showing some detials of a SQL search. In the background is a ViewModel and one of the property contains the resultrecords as array. Each new search request will create a new array of records and through a binding it changes the ItemsSource property of RadGridView. 

    new Version 2012.2.725.40: the focus will jump into the RadGridView when RadPaneGroup is floating
    old Version 2012.1.215.40: its all ok, the Fosuce stay in e.g. TextBox

    a SampleApp below

    <Window x:Class="RadGridViewFocusStealing.MainWindow"
            xmlns:RadGridViewFocusStealing="clr-namespace:RadGridViewFocusStealing" Title="MainWindow" Height="350" Width="525">
                <RowDefinition Height="50" />
                <RowDefinition Height="29" />
                <RowDefinition Height="259*" />
            <TextBlock  Grid.Row="0" Text="Make the RadPaneGroup as floating. Select a record inside of the grid, than add some new records while typing in the TextBox below. You will see the focus will lost. If the RadPaneGroup is docked its all fine." TextWrapping="Wrap" />
            <telerik:RadWatermarkTextBox  Grid.Row="1" Text="{Binding Path=DoSomethingOnChange, UpdateSourceTrigger=Explicit}" KeyUp="TextBox_KeyUp" Margin="2" >
                    <TextBlock Text="Just type any text and press ↵ Enter to apply" Foreground="Gray"/>
            <telerik:RadDocking  Grid.Row="2">
                    <telerik:RadSplitContainer x:Name="radSplitContainer" >
                            <telerik:RadPaneGroup >
                                                     ItemsSource="{Binding Path=DataItems}" ShowGroupPanel="False">
                                                <telerik:GridViewDataColumn DataMemberBinding="{Binding Path=Property1}"/>

    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Linq;
    using System.Windows;
    using System.Windows.Controls;
    using System.Windows.Input;
    using Telerik.Windows.Controls.Docking;
    namespace RadGridViewFocusStealing
        /// <summary>
        /// Interaction logic for MainWindow.xaml
        /// </summary>
        public partial class MainWindow : Window
            public MainWindow()
                radSplitContainer.InitialPosition = DockState.FloatingDockable;
            private void TextBox_KeyUp(object sender, System.Windows.Input.KeyEventArgs e)
                if (e.Key == Key.Enter && e.KeyboardDevice.Modifiers == ModifierKeys.None)
                    var b = ((TextBox)sender).GetBindingExpression(TextBox.TextProperty);
                    if (b != null)
        public class GridDataContextViewModel : INotifyPropertyChanged
            private IEnumerable<GridDataItem> _dataItems;
            public GridDataContextViewModel()
                _dataItems = new GridDataItem[] { new GridDataItem() { Property1 = "Foo" }, new GridDataItem() { Property1 = "Baa" } };
            private string _doSomethingOnChange;
            public string DoSomethingOnChange
                get { return _doSomethingOnChange; }
                    _doSomethingOnChange = value;
                    // As simulation, creating a new data array (e.g. a result of a SQLQuery as array) for GridView.ItemsSource
                    DataItems = _dataItems.Union(new GridDataItem[] { new GridDataItem { Property1 = value } }).ToArray();
            public IEnumerable<GridDataItem> DataItems
                get { return _dataItems; }
                private set
                    if (_dataItems != value)
                        _dataItems = value;
            private void OnNotifyPropertyChanged(string propertyName)
                if (PropertyChanged != null)
                    PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
            public event PropertyChangedEventHandler PropertyChanged;
        public class GridDataItem
            public string Property1 { get; set; }

  2. Ulrich
    Ulrich avatar
    10 posts
    Member since:
    Jul 2011

    Posted 21 Aug 2012 Link to this post

    With version 02259RadControls_for_WPF_2012_2_0820_DEV_hotfix (internal-build) it seems its fixed
  3. DevCraft R3 2016 release webinar banner
Back to Top