<ContentPage.Resources>
<ResourceDictionary>
<OnPlatform x:TypeArguments="x:String" x:Key="controlfontfamily" iOS="materialdesignicons-webfon" Android="materialdesignicons-webfont.ttf#Material Design Icons" />
</ResourceDictionary>
</ContentPage.Resources>
<ContentPage.Content>
<StackLayout VerticalOptions="Center">
<buttons:SfSegmentedControl DisplayMode="Image" VerticalOptions="Center" HorizontalOptions="Center">
<buttons:SfSegmentedControl.ItemsSource>
<generic:List x:TypeArguments="buttons:SfSegmentItem">
<buttons:SfSegmentItem FontIconFontColor="Green"
FontIconFontFamily="{StaticResource controlfontfamily}"
FontIconFontSize="20"
IconFont="" />
<buttons:SfSegmentItem FontIconFontColor="Green"
FontIconFontFamily="{StaticResource controlfontfamily}"
FontIconFontSize="20"
IconFont="" />
<buttons:SfSegmentItem FontIconFontColor="Green"
FontIconFontFamily="{StaticResource controlfontfamily}"
FontIconFontSize="20"
IconFont="" />
</generic:List>
</buttons:SfSegmentedControl.ItemsSource>
</buttons:SfSegmentedControl>
</StackLayout>
</ContentPage.Content> |
public class ViewModel
{
public ObservableCollection<View> ViewItems { get; set; }
public ViewModel()
{
ViewItems = new ObservableCollection<View>
{
new Item1(),
new Item2(),
};
}
} |
<buttons:SfSegmentedControl
BorderColor="Transparent"
HeightRequest="80"
HorizontalOptions="Center"
x:Name="segmentedControl"
VisibleSegmentsCount="2"
Color="Transparent"
ItemsSource="{Binding ViewItems}"
SegmentPadding="30">
<buttons:SfSegmentedControl.BindingContext>
<local:ViewModel/>
</buttons:SfSegmentedControl.BindingContext>
</buttons:SfSegmentedControl> |
is this still not possible? using as EmbededResource?
Beside that using list of view in Viewmodel, it would be great to have possibility to use ItemTemplate
Hi Emil,
In our Volume 3, 2020 release, we already included EmbededResource support. We have prepared a sample for your reference, which you can find in the attachment.
Please let us know if you have any other details.
Regards,
Ruba Shanmugam