问题描述
我是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 (将#修改为@)