Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/xamarin/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Xamarin r单选按钮。这一切都是通过自定义渲染器完成的。仍然在寻找一个很好的例子,展示在X-Forms中不使用自定义渲染器可以做什么。仅在确定有必要使用自定义渲染器后才使用。到目前为止,我认为单选按钮不够复杂,不需要自定义渲染。(X-Labs是在几年前完成的,当时X_Xamarin_Xamarin.forms - Fatal编程技术网

Xamarin r单选按钮。这一切都是通过自定义渲染器完成的。仍然在寻找一个很好的例子,展示在X-Forms中不使用自定义渲染器可以做什么。仅在确定有必要使用自定义渲染器后才使用。到目前为止,我认为单选按钮不够复杂,不需要自定义渲染。(X-Labs是在几年前完成的,当时X

Xamarin r单选按钮。这一切都是通过自定义渲染器完成的。仍然在寻找一个很好的例子,展示在X-Forms中不使用自定义渲染器可以做什么。仅在确定有必要使用自定义渲染器后才使用。到目前为止,我认为单选按钮不够复杂,不需要自定义渲染。(X-Labs是在几年前完成的,当时X,xamarin,xamarin.forms,Xamarin,Xamarin.forms,r单选按钮。这一切都是通过自定义渲染器完成的。仍然在寻找一个很好的例子,展示在X-Forms中不使用自定义渲染器可以做什么。仅在确定有必要使用自定义渲染器后才使用。到目前为止,我认为单选按钮不够复杂,不需要自定义渲染。(X-Labs是在几年前完成的,当时X-Forms比较有限。)我编辑了它,使用第二个变量来保存引用,而从不设置实际选择的项目。这允许您避免选择ListView项并向背景添加系统颜色。不过,您仍将获得悬停和单击高光。没有简单的方法可以跨平台设置列表项选定的颜色(希望xamarin的家


r单选按钮。这一切都是通过自定义渲染器完成的。仍然在寻找一个很好的例子,展示在X-Forms中不使用自定义渲染器可以做什么。仅在确定有必要使用自定义渲染器后才使用。到目前为止,我认为单选按钮不够复杂,不需要自定义渲染。(X-Labs是在几年前完成的,当时X-Forms比较有限。)我编辑了它,使用第二个变量来保存引用,而从不设置实际选择的项目。这允许您避免选择ListView项并向背景添加系统颜色。不过,您仍将获得悬停和单击高光。没有简单的方法可以跨平台设置列表项选定的颜色(希望xamarin的家伙很快就能解决这个问题)不幸的是,我的朋友,当你在xamarin.Forms UWP中尝试此操作时,radiobutton圆圈不会出现=:-{(但是-在文档中-你从未说过他们会…)Xamarin.Forms 4.6引入了一个新的单选按钮控件。您可以在这里找到文档:“-谢谢,@jfmg”
<StackLayout BackgroundColor="#30af91" Padding="60">


<Entry Text="{Binding FirstName}" Placeholder="First Name"/>
<Entry Text="{Binding LastName}" Placeholder="Last Name"/>
<Entry Text="{Binding UserName}" Placeholder="Last Name"/>
<Entry Text="{Binding Email}" Placeholder="Email" />
<Entry Text="{Binding Password}" Placeholder="Password" IsPassword="True"/>
<Entry Text="{Binding ConfirmPassword}" Placeholder="Confirm Password" IsPassword="True"/>
<DatePicker MinimumDate="1/1/1948" MaximumDate="12/31/2007"/>


<!--Radio buttons for Gender
    1. Male   2.Female-->

<!--Radio Buttons for UserRole
    1. Admin  2.Participant-->

<Button Command="{Binding RegisterCommand}" Text="Register"/>
<Label Text="{Binding Message}" />


</StackLayout>
<Image  Scale="0.7"  HorizontalOptions="Start" x:Name="radioButton" Source="unRadioBtn.png">
                    <Image.GestureRecognizers>
                        <TapGestureRecognizer Tapped="radioButton_Clicked"></TapGestureRecognizer>
                    </Image.GestureRecognizers>
                </Image>
 private void radioButton_Clicked(object sender, EventArgs e)
    {
        radioButton.Source = "radioBtn.png";
    }
var answers = new List<string>();
answers.Add("Yes");
answers.Add("No");

var RadioGroup = new XLabs.Forms.Controls.BindableRadioGroup()
{
  ItemsSource = answers, 
  Orientation = StackOrientation.Horizontal
};
controls:BindableRadioGroup x:Name="Radiobtn"
string[] gender = {"MAlE","FEMALE"}
Radiobtn.Add(gender)
<ListView
    HasUnevenRows="True"
    HorizontalOptions="FillAndExpand"
    ItemsSource="{Binding Durations}"
    ItemSelected="ListView_ItemSelected"
    SelectedItem="{Binding SelectedDuration}">
    <ListView.ItemTemplate>
        <DataTemplate>
            <ViewCell>
                <StackLayout
                    Orientation="Horizontal">
                    <Image
                        HeightRequest="18"
                        IsVisible="{Binding IsSelected}"
                        Source="radioButtonChecked.png"
                        WidthRequest="18"/>
                    <Image
                        HeightRequest="18"
                        IsVisible="{Binding IsUnselected}"
                        Source="radioButtonUnchecked.png"
                        WidthRequest="18"/>
                    <Label
                        Margin="8,0,0,0"
                        Text="{Binding Caption}"/>
                </StackLayout>
            </ViewCell>
         </DataTemplate>
      </ListView.ItemTemplate>
   </ListView>
public partial class LoginPage : ContentPage
{
    LoginPageViewModel LoginPageViewModel { get; }

    public LoginTwoFactorFrequencyPage ()
    {
        BindingContext = LoginPageViewModel = new LoginPageViewModel();

        InitializeComponent ();
    }

    private void ListView_ItemSelected(object sender, SelectedItemChangedEventArgs e)
    {
        LoginPageViewModel.UpdateSelected(e.SelectedItem as PersistenceDuration);
    }
}
public class PersistenceDuration : ViewModelBase
{
    bool isSelected;

    public string Caption { get; set; }
    public TwoFactorTokenPersistenceDuration Duration { get; set; }
    public bool IsSelected
    {
        get => isSelected;
        set
        {
            isSelected = value;
            OnPropertyChanged();
            OnPropertyChanged("IsUnselected");
        }
    }
    public bool IsUnselected => !IsSelected;

    public PersistenceDuration(string caption, TwoFactorTokenPersistenceDuration duration)
    {
        Caption = caption;
        Duration = duration;
        IsSelected = false;
    }
}
public class LoginPageViewModel : ViewModelBase
{
    PersistenceDuration duration;
    PersistenceDuration selectedDuration;

    public ObservableCollection<PersistenceDuration> Durations { get; }
    public PersistenceDuration SelectedDuration
    {
        get => selectedDuration;
        set
        {
            if (value != null)
            {
                duration = value;
                UpdateSelected(duration);
            }
            OnPropertyChanged();
        }
    }

    public LoginTwoFactorFrequencyViewModel()
    {
        Durations = new ObservableCollection<PersistenceDuration>(
            new List<PersistenceDuration>()
            {
                new PersistenceDuration(AppResources.Save_code__forever, TwoFactorTokenPersistenceDuration.Forever),
                new PersistenceDuration(AppResources.ChatRequireEvery30Days, TwoFactorTokenPersistenceDuration.ThirtyDays),
                new PersistenceDuration(AppResources.ChatRequireEveryLogin, TwoFactorTokenPersistenceDuration.None),
            });
    }

    public void UpdateSelected(PersistenceDuration persistenceDuration)
    {
        foreach (var item in Durations)
            item.IsSelected = persistenceDuration == item;
    }
}