RadTaskBoard find item and scrolling into.

2 Answers 97 Views
TaskBoard
Mohamad
Top achievements
Rank 1
Mohamad asked on 23 Sep 2023, 01:27 PM

Hello,

My Radtaskboard contains dozens of items. How do I find an item and scroll to it so the user can find it?
I have made this code:


 foreach (taskboarddata item in MyRadTaskBoard.Items)
 {
     if (item.Id == itemidsearch)
     {
         this.MyRadTaskBoard.SelectedItem = item;


but only selection, the UI does not direct/point to the item.

Thank you for your help.

2 Answers, 1 is accepted

Sort by
0
Dimitar
Telerik team
answered on 25 Sep 2023, 01:27 PM

Hello Mohamad,

I am afraid that there is no built-in method for this. You can manually calculate the scroll offset:

 var scroll = taskBoard.FindChildByType<ScrollViewer>();
 int itemIndex = 20; 
 var offset = (scroll.ScrollableWidth / taskBoard.Items.Count) * itemIndex;
 scroll.ScrollToHorizontalOffset(offset);

I hope this helps. Should you have any other questions do not hesitate to ask.

Regards,
Dimitar
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Mohamad
Top achievements
Rank 1
commented on 26 Sep 2023, 06:43 AM

Hello Dimitar, 
Thank you for the response.
What I mean is scroll vertically down in the appropriate column. My taskboard has 4 columns. How do I find the right scroll viewer?
Dimitar
Telerik team
commented on 26 Sep 2023, 09:19 AM

Hi Mohamad, 

Can you send us a small sample project that shows your case? Perhaps with some sample data that shows how the control is populated.  This will allow us to properly investigate your case and provide a solution. 

Thank you in advance for your patience and cooperation. 

0
The Nimble Coder
Top achievements
Rank 2
Iron
answered on 27 Feb 2024, 08:49 PM

Hello Dimitar, 

Regarding your code above where you show how to manually calculate the scroll offset, can you post more snippets around how this is used and the xaml where the ScrollViewer is defined? Mvvm if possible as well.

Thanks Dimitar.

-Mark

Dimitar
Telerik team
commented on 28 Feb 2024, 07:10 AM

Hello Mark, 

I have attached my test project. There is nothing specific about the XAML in this case. The scroll viewer is defined in the control template

The Nimble Coder
Top achievements
Rank 2
Iron
commented on 28 Feb 2024, 12:32 PM

Thank Dimitar. Very much appreciated.

-Mark

Tags
TaskBoard
Asked by
Mohamad
Top achievements
Rank 1
Answers by
Dimitar
Telerik team
The Nimble Coder
Top achievements
Rank 2
Iron
Share this question
or