【问题标题】:RadioButtons and CheckBoxes not working properly on iOS and UWP单选按钮和复选框在 iOS 和 UWP 上无法正常工作
【发布时间】:2017-04-17 07:21:41
【问题描述】:

我正在使用Xamarin 中的Visual Studio 2015 开发跨平台应用程序。我正在使用XLabs.Forms v2.3.0- pre 05,但我遇到了radio buttonscheckboxes 的问题。

现在checkboxesUWP 上工作正常,但它们不会在iOS 上显示。

UWP 上的单选按钮根本不起作用,而iOS 上仅显示文本

见下图。

这是我的复选框代码:

<ListView x:Name="lv_ReportQuestions">
          <ListView.ItemTemplate>
            <DataTemplate>
              <ViewCell>
                <StackLayout 
                  Orientation="Vertical"
                >
                  <StackLayout Orientation="Horizontal" HorizontalOptions="FillAndExpand">

                    <StackLayout WidthRequest="{Binding DisplayWidth}">
                      <Label HorizontalOptions="FillAndExpand" Text="{Binding ItemName}" VerticalOptions="Center" LineBreakMode="WordWrap"/>
                    </StackLayout>

                    <controls:CheckBox DefaultText="" WidthRequest="40" IsEnabled="false" IsVisible="true" Checked="true" HorizontalOptions="EndAndExpand"/>

                  </StackLayout>
                  <Label HorizontalOptions="FillAndExpand" Text="{Binding SubText}" VerticalOptions="Center"/>
                </StackLayout>
            </ViewCell>
          </DataTemplate>
        </ListView.ItemTemplate>
</ListView>

这是我的单选按钮代码:

<Label Text="Radio Buttons"/>

    <Frame
        HorizontalOptions="FillAndExpand"
        VerticalOptions="CenterAndExpand"
        OutlineColor="#000000"
      >
      <controls:BindableRadioGroup x:Name="ansPicker"
                                   IsVisible="true"/>
    </Frame>

ansPicker.ItemsSource = new[]
        {
            "Red",
            "Blue",
            "Green",
            "Yellow",
            "Orange"
        };

我尝试了其他可能的修复方法,但对我没有任何效果。

【问题讨论】:

    标签: ios xamarin uwp cross-platform xlabs


    【解决方案1】:

    Xamarin.Forms 未定义任何 CheckBox 控件或单选按钮。您可以使用 Switch 来满足您的期望。或者使用this等库

    【讨论】:

      猜你喜欢
      • 2017-11-04
      • 2013-11-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-08-17
      • 2013-08-26
      相关资源
      最近更新 更多