This is a migrated thread and some comments may be shown as answers.

Expose ScrollIntoView method for GridViewItemsSourceProvider.

4 Answers 162 Views
MultiColumnComboBox
This is a migrated thread and some comments may be shown as answers.
Huan jia
Top achievements
Rank 1
Iron
Huan jia asked on 11 Mar 2019, 03:15 AM
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. 

4 Answers, 1 is accepted

Sort by
0
Dilyan Traykov
Telerik team
answered on 13 Mar 2019, 01:18 PM
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.
0
Huan jia
Top achievements
Rank 1
Iron
answered on 14 Mar 2019, 01:51 AM

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.

0
Accepted
Dilyan Traykov
Telerik team
answered on 15 Mar 2019, 03:14 PM
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.
0
Huan jia
Top achievements
Rank 1
Iron
answered on 18 Mar 2019, 05:57 AM

Yes Dilyan

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

Tags
MultiColumnComboBox
Asked by
Huan jia
Top achievements
Rank 1
Iron
Answers by
Dilyan Traykov
Telerik team
Huan jia
Top achievements
Rank 1
Iron
Share this question
or