maui-linux/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issu.../Issue2951.xaml

48 строки
2.3 KiB
XML

<?xml version="1.0" encoding="UTF-8"?>
<controls:TestContentPage xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:controls="clr-namespace:Xamarin.Forms.Controls;assembly=Xamarin.Forms.Controls" x:Name="ThePageIssue2951" x:Class="Xamarin.Forms.Controls.Issues.Issue2951">
<controls:TestContentPage.Resources>
<ResourceDictionary>
<Style x:Key="ButtonStyle" TargetType="Button">
<Setter Property="BackgroundColor" Value="Silver" />
<Setter Property="TextColor" Value="Black" />
<Style.Triggers>
<Trigger Property="controls:ButtonExtensions.IsPrimary" Value="True" TargetType="Button">
<Setter Property="BackgroundColor" Value="#FAC54A" />
</Trigger>
</Style.Triggers>
</Style>
<Style x:Key="ChangeStatusButton" TargetType="Button" BasedOn="{StaticResource ButtonStyle}">
<Setter Property="controls:ButtonExtensions.IsPrimary" Value="False" />
<Setter Property="Text" Value="A" />
<Setter Property="Command" Value="{Binding Source={x:Reference ThePageIssue2951},Path=BindingContext.ButtonTapped}" />
<Setter Property="CommandParameter" Value="{Binding .}" />
<Style.Triggers>
<DataTrigger Binding="{Binding IsStarted}" Value="True" TargetType="Button">
<Setter Property="controls:ButtonExtensions.IsPrimary" Value="True" />
<Setter Property="Text" Value="B" />
</DataTrigger>
</Style.Triggers>
</Style>
<DataTemplate x:Key="TheItemTemplate">
<ViewCell>
<ViewCell.View>
<Grid Padding="12,5" RowSpacing="4">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="75" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Label Grid.Column="0" Text="{Binding Name}" TextColor="Yellow" />
<Button AutomationId="btnChangeStatus" Grid.Column="1" Style="{StaticResource ChangeStatusButton}" />
</Grid>
</ViewCell.View>
</ViewCell>
</DataTemplate>
</ResourceDictionary>
</controls:TestContentPage.Resources>
<controls:TestContentPage.Content>
<ListView ItemTemplate="{StaticResource TheItemTemplate}" ItemsSource="{Binding Items}" RowHeight="74" />
</controls:TestContentPage.Content>
</controls:TestContentPage>