【问题标题】:XAML Slider Orientation not found [duplicate]未找到 XAML 滑块方向 [重复]
【发布时间】:2019-01-31 22:31:44
【问题描述】:

我正在尝试在 Xamarin.Forms 中创建一个垂直滑块。但是,当我尝试此代码时,我总是会遇到错误。

<?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="Project1.DeviceInfoView"
Title="{Binding DeviceName}">

...

<Slider x:Name="slider"
Grid.Row="0"
Grid.ColumnSpan="5"
MaximumTrackColor="Gray"
MinimumTrackColor="#F7941E"
Minimum="0"
Orientation="Vertical"
Maximum="10"
Margin="10,0"
Value="{Binding SliderValue}"/>

我收到的错误是“错误:位置 65:25。没有为 'Orientation' 找到属性、可绑定属性或事件,或者值和属性之间的类型不匹配。”

我尝试创建一个新项目并在其中构建一个垂直滑块,但没有奏效。任何帮助深表感谢!谢谢!

【问题讨论】:

标签: visual-studio xaml xamarin xamarin.forms


【解决方案1】:

同意Ashray,如果你想实现垂直滑块,只需在silder选项卡下使用Rotation="90"即可。

这是运行时间的 GIF。

    <StackLayout>
    <!-- Place new controls here -->
    <Label Text="Welcome to Xamarin.Forms!" 
           HorizontalOptions="Center"
           VerticalOptions="CenterAndExpand" 
           BindingContext="{x:Reference Name=slider}"
           Rotation="{Binding Path=Value }"/>

    <Slider x:Name="slider"
            Grid.Row="0"
            Grid.ColumnSpan="5"
            MaximumTrackColor="Gray"
            MinimumTrackColor="#F7941E"
            Minimum="0"
            Rotation="90"
            Maximum="10"
            Margin="10,0"
    />
</StackLayout>

【讨论】:

    猜你喜欢
    • 2016-11-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-08-09
    • 2021-12-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多