|
<buttons:SfChipGroup x:Name="chip" Type="Choice" ChoiceMode="Single"
SelectedChipBackgroundColor="Green" ChipBackgroundColor="Brown"
HorizontalOptions="Center">
<buttons:SfChipGroup.Items>
<buttons:SfChip x:Name="chip1" Text="1" BackgroundColor="Brown" BorderWidth="2" BorderColor="Black" CornerRadius="5"/>
<buttons:SfChip x:Name="chip2" Text="2" BackgroundColor="Brown" BorderWidth="2" BorderColor="Black" CornerRadius="5"/>
<buttons:SfChip x:Name="chip3" Text="3" BackgroundColor="Brown" BorderWidth="2" BorderColor="Black" CornerRadius="5"/>
</buttons:SfChipGroup.Items>
</buttons:SfChipGroup> |
|
chip.SelectedItem = chip.Items[0]; |
|
<ContentPage.BindingContext>
<viewModel: ViewModel x:Name="viewModel"/>
</ContentPage.BindingContext>
<buttons:SfChipGroup x:Name="chip" Type="Choice" ChoiceMode="Single"
SelectedChipBackgroundColor="Green" ChipBackgroundColor="Brown"
HorizontalOptions="Center" ItemsSource="{Binding list}"/> |
|
chip.SelectedItem = viewModel.list[0]; |
|
public class ViewModel
{
public ViewModel()
{
list = new ObservableCollection<string>()
{
"1", "2", "3", "4"
};
}
} |