Hi Cameron,
My apologies, I was incorrect in stating this control is one the of the purely Xamarin.Forms controls in the suite. While exploring the source code to find a property you could use for reflection purposes, I discovered that you can indeed extend the control's renderer to access the native elements.
The renderer's class name is
SegmentedControlRenderer, this is what you can inherit from on each platform
Demo
As one example, I created a custom renderer for the UWP project, in which the native control has an ItemTemplate property you can set. So I first created a DataTemplate in App.xaml with a key "
CustomSegmentItemTemplate", which contains a TextBlock with
TextWrapping set to Wrap:
In the Custom Renderer, I do the following:
- Extend the Telerik
SegmentedControlRenderer
- Added the required assembly attribute so that the app will
use the custom renderer instead of the default one
-
Set the ItemTemplate using
the DataTemplate that was defined in App.xaml
Here's the result at runtime
Next Steps
You will of course need to take a similar approach across all the platforms and use that platform's specific approach for wrapping text.
In the case of iOS and Android, I wasn't able to immediately find a way to set the text wrapping, however I'm the UWP expert and am not intimately familiar with the iOS and Android level platform specifics for text wrapping.
I'll ask the development team members if there is a way to set the text wrapping on the native control, but it may be the case that the reason why we haven't exposed an ItemTemplate or Text wrapping attribute yet is due to native control limitations. In the meantime here are a couple screenshots from my attached demo to give you a head start on iOS and Android:
iOS
Android
If you get stuck, open a Support Ticket. We do try to monitor and answer the forums, but this is limited to available resources. Whereas a support ticket carries high priority and gets assigned directly to the engineers who actually built the component.
I hope I was able to get you closer to your goal.
Regards,
Lance | Tech Support Engineer, Sr.
Progress Telerik
Do you want to have your say when we set our development plans?
Do you want to know when a feature you care about is added or when a bug fixed?
Explore the
Telerik Feedback Portal
and vote to affect the priority of the items