Suspended ball

1 Answer 69 Views
Button
zhe
Top achievements
Rank 1
Iron
Iron
zhe asked on 20 Apr 2022, 02:52 PM
Does telerik have controls that can be suspended? Suspension balls similar to IOS can be moved at will.
Lance | Senior Manager Technical Support
Telerik team
commented on 20 Apr 2022, 03:40 PM

Hi Zhe, I am unfamiliar with suspension ball control concept. Can you provide a link to an example?

zhe
Top achievements
Rank 1
Iron
Iron
commented on 21 Apr 2022, 01:48 PM

For example, put a button in the Scrollview control. When sliding up and down, the button remains in place and is not affected by the sliding.

1 Answer, 1 is accepted

Sort by
0
Lance | Senior Manager Technical Support
Telerik team
answered on 21 Apr 2022, 03:41 PM

Hello Zhe,

Thank you for the description. Telerik UI for MAUI doesn't have a control that has that specific behavior. although we do have some features that achieve it, like sticky group headers in a Grid/List, but there's no individual control that will integrate with a base ScrollView like that.

Universal Custom Approach

The good news is that you could easily implement this yourself by subscribing to the ScrollView's Scrolled event and use the e.Scroll value for the other element's Translate value. This will ensure the child element in the ScrollView's visible canvas area.

Here's an example that will always keep a RadButton in view, regardless of scroll direction:

private void ScrollView_Scrolled(object sender, ScrolledEventArgs e)
{
    MyButton.TranslationX = e.ScrollX;
    MyButton.TranslationY = e.ScrollY;
}

I've attached a runnable example

Regards,
Lance | Manager Technical Support
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.

Lance | Senior Manager Technical Support
Telerik team
commented on 21 Apr 2022, 03:45 PM

I just realized that I created a .NET MAUI project instead of a Xamarin.Forms project, but that's okay because the code is 100% compatible in Xamarin.Forms.
zhe
Top achievements
Rank 1
Iron
Iron
commented on 22 Apr 2022, 04:04 AM

Thank you, manager LAN. The problem has been solved
Tags
Button
Asked by
zhe
Top achievements
Rank 1
Iron
Iron
Answers by
Lance | Senior Manager Technical Support
Telerik team
Share this question
or