Expose ScrollIntoView method for GridViewItemsSourceProvider.

5 posts, 1 answers
  1. Huan jia
    Huan jia avatar
    4 posts
    Member since:
    Jun 2013

    Posted 10 Mar Link to this post

    When i set SelectedItem back to MultiColumnComboBox programmatically, if the selectedItem is below the top items, not in view, the control cannot auto scroll to the right position,so could you expose a ScrollIntoView method. 
  2. Dilyan Traykov
    Admin
    Dilyan Traykov avatar
    1033 posts

    Posted 13 Mar Link to this post

    Hello Huan,

    Even though by default the dropdown element for the RadMultiColumnComboBox is a RadGridView, we would like to enable users to define their own dropdown content which could be any control. With this said, exposing a ScrollIntoView method for the RadMultiColumnComboBox may not make sense in all use cases.

    Thus, what I can suggest is to get ahold of the RadGridView instance by utilizing the ChildrenOfType extension method or via the DropDownContentManager.DropDownElement property of the combo box and then call the ScrollIntoView method of the respective instance. Please note that in both cases the combo box should be opened prior to this operation so that the RadGridView is loaded.

    Please let me know whether this would work for you or if you require any further assistance with the specific implementation.

    Regards,
    Dilyan Traykov
    Progress TelerikWant to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
  3. Huan jia
    Huan jia avatar
    4 posts
    Member since:
    Jun 2013

    Posted 13 Mar in reply to Dilyan Traykov Link to this post

    Hi, Dilyan

    As you said, combo box should be opened prior to this operation so that the RadGridView is loaded.

    But RadMultiColumnComboBox don't have a DropDownOpened Event as "System.Windows.Controls.ComboBox" does, And what i mean is to add a ScrollIntoView method to GridViewItemsSourceProvider class, not to RadMultiColumnComboBox class.

  4. Answer
    Dilyan Traykov
    Admin
    Dilyan Traykov avatar
    1033 posts

    Posted 15 Mar Link to this post

    Hi Huan,

    We've designed the GridViewItemsSourceProvider to be easily definable in XAML and we would like to avoid exposing any of RadGridView's methods through it and polluting the class' API unless really necessary.

    Exposing a DropDownOpened event for the RadMultiColumnComboBox, however, seems reasonable and I have thus logged the following feature request on your behalf regarding this.

    For the time being, however, you can handle the RadDropDownButton.DropDownOpenedEvent event instead, like so (where mccb is a reference to your RadMultiColumnComboBox):

    this.mccb.AddHandler(RadDropDownButton.DropDownOpenedEvent, new RoutedEventHandler(Button_DropDownOpened));

    private void Button_DropDownOpened(object sender, RoutedEventArgs e)
    {
        this.mccb.Dispatcher.BeginInvoke(new Action(() =>
        {
            (this.mccb.DropDownContentManager.DropDownElement as RadGridView).ScrollIndexIntoView(15);
        }));
    }

    Please let me know whether this would work for you.

    Regards,
    Dilyan Traykov
    Progress TelerikWant to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
  5. Huan jia
    Huan jia avatar
    4 posts
    Member since:
    Jun 2013

    Posted 18 Mar in reply to Dilyan Traykov Link to this post

    Yes Dilyan

    Your solution worked for me, problem solved, thank you.

Back to Top