|
<buttons:SfChip Text="Chip" ShowIcon="True" ImageWidth="25" ImageAlignment="End" TextColor="White">
<buttons:SfChip.ImageSource>
<FontImageSource Glyph=""
FontFamily="{OnPlatform iOS=Segoe MDL2 Assets, Android=SegMDL2.ttf#Segoe MDL2 Assets,UWP=/Assets/SegMDL2.ttf#Segoe MDL2 Assets}"
/>
</buttons:SfChip.ImageSource>
</buttons:SfChip> |
|
Property |
Usage |
|
To enable the provided image. By default it has false. | |
|
To customize the size of added close button image | |
|
To align the image at last. |
|
<buttons:SfChip Text="Chip" x:Name="chip" ShowCloseButton="True">
<buttons:SfChip.Content>
<Grid HeightRequest="35">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<!--close button width-->
<ColumnDefinition Width="28"/>
</Grid.ColumnDefinitions>
<Label Text="{Binding Source={x:Reference chip},Path=Text}" TextColor="White" HorizontalOptions="Center" VerticalOptions="Center"/>
<Label HorizontalOptions="Center" IsVisible="{Binding Source={x:Reference chip},Path=ShowCloseButton}" Text="" FontSize="18" Margin="0,0,3,0" Grid.Column="1" VerticalOptions="Center">
<Label.FontFamily>
<OnPlatform iOS="Segoe MDL2 Assets" Android="SegMDL2.ttf#Segoe MDL2 Assets" UWP="/Assets/SegMDL2.ttf#Segoe MDL2 Assets"/>
</Label.FontFamily>
</Label>
</Grid>
</buttons:SfChip.Content>
</buttons:SfChip> |
|
<buttons:SfChipGroup
ItemsSource="{Binding Languages}"
ChipBorderWidth="0">
<buttons:SfChipGroup.ItemTemplate>
<DataTemplate>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<!--close button width-->
<ColumnDefinition Width="20"/>
</Grid.ColumnDefinitions>
<Label Text="{Binding Name}" HorizontalOptions="Center" VerticalOptions="Center"/>
<Label HorizontalOptions="Center" FontSize=”20” Grid.Column="1" VerticalOptions="Center">
<Label.Text>
<OnPlatform Default="" UWP=""/>
</Label.Text>
<Label.FontFamily>
<OnPlatform iOS="V1 Font Material icon" Android="SfButton.ttf#V1 Font Material icon"
UWP="/Assets/sfbutton_Segoe MDL2 Assets.ttf#Segoe MDL2 Assets"/>
</Label.FontFamily>
<!--To recognize the close button tap to remove the item from the chipgroup-->
<Label.GestureRecognizers>
<TapGestureRecognizer Command="{Binding TapCloseButton}" CommandParameter="{x:Reference viewModel}"/>
</Label.GestureRecognizers>
</Label>
</Grid>
</DataTemplate>
</buttons:SfChipGroup.ItemTemplate>
</buttons:SfChipGroup>
|
|
public class Language
{
public Xamarin.Forms.Command CloseButtonTapped { get; set; }
public string Name { get; set; }
public Language()
{
CloseButtonTapped = new Xamarin.Forms.Command(TapCloseButton);
}
private void TapCloseButton(object e)
{
ViewModel viewModel = e as ViewModel;
viewModel.Languages.Remove(this);
}
} |
|
<buttons:SfChipGroup
ItemsSource="{Binding Languages}"
ChipBorderWidth="0">
<buttons:SfChipGroup.ItemTemplate>
<DataTemplate>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<!--close button width-->
<ColumnDefinition Width="20"/>
</Grid.ColumnDefinitions>
<Label Text="{Binding Name}" HorizontalOptions="Center" VerticalOptions="Center"/>
<Label HorizontalOptions="Center" FontSize="20" Grid.Column="1" VerticalOptions="Center">
<Label.Text>
<OnPlatform Default="" UWP=""/>
</Label.Text>
<Label.FontFamily>
<OnPlatform iOS="V1 Font Material icon" Android="SfButton.ttf#V1 Font Material icon"
UWP="/Assets/sfbutton_Segoe MDL2 Assets.ttf#Segoe MDL2 Assets"/>
</Label.FontFamily>
<!--To recognize the close button tap to remove the item from the chipgroup-->
<Label.GestureRecognizers>
<TapGestureRecognizer Command="{Binding TapCloseButton}" CommandParameter="{x:Reference viewModel}"/>
</Label.GestureRecognizers>
</Label>
</Grid>
</DataTemplate>
</buttons:SfChipGroup.ItemTemplate>
</buttons:SfChipGroup> |
|
public class Language
{
public Xamarin.Forms.Command CloseButtonTapped { get; set; }
public string Name { get; set; }
public Language()
{
CloseButtonTapped = new Xamarin.Forms.Command(TapCloseButton);
}
private void TapCloseButton(object e)
{
ViewModel viewModel = e as ViewModel;
viewModel.Languages.Remove(this);
}
} |