Thread ID: |
Created: |
Updated: |
Platform: |
Replies: |
148143 | Oct 8,2019 03:33 AM UTC | Oct 14,2019 06:29 AM UTC | Xamarin.Forms | 4 |
![]() |
Tags: SfRadioButton |
<listView:SfListView.ItemTemplate>
<DataTemplate>
<StackLayout>
<Label
FontSize="Medium"
HorizontalTextAlignment="Center"
Text="{Binding Info}"/>
<StackLayout
x:Name="radioGroup"
BindableLayout.ItemsSource="{Binding States}">
<BindableLayout.ItemTemplate>
<DataTemplate>
<button:SfRadioButton
Margin="8,12,8,0"
GroupKey="{Binding GroupKey}"
HorizontalOptions="FillAndExpand"
Text="{Binding Name}"
IsChecked="{Binding IsChecked,Mode=TwoWay}"/>
</DataTemplate>
</BindableLayout.ItemTemplate>
</StackLayout>
</StackLayout>
</DataTemplate>
</listView:SfListView.ItemTemplate> |
public class IssueState: INotifyPropertyChanged
{
public string Name { get; set; }
public SfRadioGroupKey GroupKey { get; set; }
. . .
} |
public class IssueViewModel: INotifyPropertyChanged
{
public SfRadioGroupKey GroupKey { get; set; }
private ObservableCollection<IssueState> _states;
public ObservableCollection<IssueState> States
{
get
{
GroupKey = new SfRadioGroupKey();
if(_states != null)
{
foreach (var item in _states)
{
item.GroupKey = GroupKey;
}
}
return _states;
}
set
{
if (_states == value)
return;
_states = value;
OnPropertyChanged();
}
}
} |
This post will be permanently deleted. Are you sure you want to continue?
Sorry, An error occured while processing your request. Please try again later.
This page will automatically be redirected to the sign-in page in 10 seconds.