gpt4 book ai didi

android - 带触发器的平台

转载 作者:行者123 更新时间:2023-11-29 19:09:02 27 4
gpt4 key购买 nike

我想将 Onplatform 与 IOS 和 Android 的不同触发器一起使用,但不知道如何或是否可能。在 IOS 上,我想使用不同的边距。

代码如下:

<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"></RowDefinition>
<RowDefinition Height="Auto"></RowDefinition>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"></ColumnDefinition>
</Grid.ColumnDefinitions>
<!--left, top, right, bottom-->
<Label Text="{Binding article description}"
FontAttributes="Bold" FontSize="13" Margin="10,5,0,-6" Grid.Row="0" LineBreakMode="NoWrap"/>

<Label x:Name="Labeldishe" Text="{Binding dishe}"
FontSize="13" Margin="10,0,0,2" Grid.Row="1"/>
<Label Grid.Row="0" x:Name="Labelreserved" Text="{Binding reserved}" IsVisible="false" LineBreakMode="NoWrap"/>
<Image x:Name="ImageReserve" Grid.Row="0" Source="checkmark.png" WidthRequest="8" HeightRequest="8" HorizontalOptions="Start" IsVisible="False" >
<Image.Triggers>
<DataTrigger TargetType="Image" Binding="{Binding Source={x:Reference Labelreserved},
Path=Text.Length}" Value="7">
<Setter Property="IsVisible" Value="true" />
</DataTrigger>
<DataTrigger TargetType="Image" Binding="{Binding article description}" Value="Meat">
<Setter Property="Margin" Value="43,0,0,0" />
</DataTrigger>
<DataTrigger TargetType="Image" Binding="{Binding article description}" Value="Option">
<Setter Property="Margin" Value="46,0,0,0" />
</DataTrigger>
<DataTrigger TargetType="Image" Binding="{Binding article description}" Value="Diet">
<Setter Property="Margin" Value="40,0,0,0" />
</DataTrigger>
<DataTrigger TargetType="Image" Binding="{Binding article description}" Value="Fish">
<Setter Property="Margin" Value="42,0,0,0" />
</DataTrigger>
</Image.Triggers>
</Image>
</Grid>

最佳答案

我不是很确定,但如果支持的话,我想应该是这样的:

<DataTrigger TargetType="Image" Binding="{Binding article description}" Value="Carne">
<Setter Property="Margin">
<Setter.Value>
<OnPlatform x:TypeArguments="Thickness">
<On Platform="iOS" Value="44,0,0,0" />
<On Platform="Android" Value="43,0,0,0" />
</OnPlatform>
</Setter.Value>
</Setter>
</DataTrigger>

关于android - 带触发器的平台,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46056788/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com