我試圖複製following example以瞭解Xamarin中的綁定。使用DataBinding旋轉標籤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="DataBinding.MyPage" Title="Slider Bindings Page">
<StackLayout>
<Label Text="ROTATION"
BindingContext="{x:Reference Name=slider}"
Rotation="{Binding Path=Value}"
Font="Bold, Large"
HorizontalOptions="Center"
VerticalOptions="CenterAndExpand" />
<Slider x:Name="slider"
Maximum="360"
VerticalOptions="CenterAndExpand" />
<Label BindingContext="{x:Reference slider}"
Text="{Binding Value,
StringFormat='The angle is {0:F0} degrees'}"
Font="Large"
HorizontalOptions="Center"
VerticalOptions="CenterAndExpand" />
</StackLayout>
</ContentPage>
嘗試旋轉=「{綁定值}」 – Jason 2014-10-09 20:09:01
@Jason,不,它沒有。 – casillas 2014-10-09 20:13:42
我剛剛在所有3個平臺上運行示例,即使在iOS上也能正常運行。你是否試圖在你自己的新項目中複製它?或者你只是將它作爲現有示例解決方案的一部分運行? – Pete 2014-10-09 20:44:13