如何解决Slider在Visual Studio Xamarin Form Previewer在Windows上中不起作用我无法拖动滑块
我是Xamarin Form的新手。我正在自学Xamarin Form课程。我在具有Android版本(目标框架)-Android 8.1(奥利奥)的Windows操作系统上使用VS社区2017。我已经设置了表单预览器。我真的不知道滑块是否由于设置或代码或android版本(默认目标框架-android 8.1 oreo)而无法工作。
我的XAML代码在下面
<? xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns = "http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="WarMemorial.GreetingPage"
Title="HSL Color Sliders"
>
<ContentPage.Content>
<StackLayout VerticalOptions = "Center" HorizontalOptions="Center" >
<Label BindingContext = "{x:Reference slider}"
Text="{Binding Value,StringFormat='Value is {0:F2}'}"
Opacity="{Binding Value}"
x:Name="label"/>
<Slider x:Name="slider" Maximum = "100"
></Slider>
</StackLayout>
</ContentPage.Content>
</ContentPage>
XAML.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Xamarin.Forms;
using Xamarin.Forms.Xaml;
namespace WarMemorial
{
[XamlCompilation(XamlCompilationOptions.Compile)]
public partial class GreetingPage : ContentPage
{
public GreetingPage()
{
InitializeComponent();
slider.Value = 0.5;
}
}
}
因此,我无法在窗体预览器中拖动滑块。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。