We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

SfSegmentedControl with icons - no sample

Hi,
Your docs in section "Display mode" for SfSegmentCOntrol doesn't make any sense. You wrote that we can populate ItemSource with items to make SfSegmentControl  display Icons and text. There is one problem: there is no way to do that. Even in your sample code in docs you just populate SfSegmentItem with only text, but how ca you add icon? There is no property for icon or something similar.
Please, provide a sample with custom icon and text in Segmented Control.

Regards

1 Reply

MK Muneesh Kumar G Syncfusion Team March 29, 2019 05:03 AM

Hi Przemyslaw,  
 
Greetings from Syncfusion. 
 
We have created a sample for SfSegmentedControl as per your requirement. When DisplayMode is ImageWithText, items populated in control will be displayed as icons with text.  
 
We have IconFont and Text property in SfSegmentItem to set icon and text in SfSegmentedControl. Please check the code snippet for your reference. 
 
Code Snippet: 
 
new SfSegmentItem(){ IconFont = "6", FontIconFontColor = Color.FromHex("#FFFFFF"), FontColor=Color.FromHex("#FFFFFF"), Text = "Day"},  
 
Please use the font.ttf file code on the XAML code as mentioned below. 
  
<buttons:SfSegmentedControl.FontIconFontFamily> 
<OnPlatform x:TypeArguments="x:String"> 
<On Platform="Android" Value="SegmentIcon.ttf" />               
<On Platform="UWP" Value="/Assets/SegmentIcon.ttf#segment2" />                 
<On Platform="iOS" Value="segment2" />          
</OnPlatform>     
</buttons:SfSegmentedControl.FontIconFontFamily> 
 
Please download the sample from the below link: 
 
 
Please refer the following link to know more details about how to set custom font SfSegmentedControl.  
 
 
Please let us know if you have any concern about this. 
 
Regards, 
Muneesh Kumar G. 


Loader.
Live Chat Icon For mobile
Up arrow icon