<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();
}
}
} |