maui-linux/samples/ControlGallery/Pages/TogglesPage.xaml

103 lines
4.9 KiB
XML

<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="ControlGallery.Pages.TogglesPage"
Title="Toggles">
<ScrollView>
<VerticalStackLayout Spacing="20" Padding="20">
<Label Text="Toggle Controls" FontSize="24" FontAttributes="Bold" />
<!-- CheckBox -->
<Frame Padding="15" CornerRadius="8">
<VerticalStackLayout Spacing="10">
<Label Text="CheckBox" FontAttributes="Bold" />
<HorizontalStackLayout Spacing="10">
<CheckBox x:Name="AgreeCheckBox" CheckedChanged="OnCheckBoxChanged" />
<Label Text="I agree to the terms" VerticalOptions="Center" />
</HorizontalStackLayout>
<Label x:Name="CheckBoxLabel" Text="Not agreed" TextColor="{StaticResource Gray500}" />
</VerticalStackLayout>
</Frame>
<!-- Styled CheckBoxes -->
<Frame Padding="15" CornerRadius="8">
<VerticalStackLayout Spacing="10">
<Label Text="Styled CheckBoxes" FontAttributes="Bold" />
<HorizontalStackLayout Spacing="20">
<CheckBox Color="{StaticResource Primary}" IsChecked="True" />
<CheckBox Color="#4CAF50" IsChecked="True" />
<CheckBox Color="#FF5722" IsChecked="True" />
<CheckBox Color="#2196F3" IsChecked="True" />
</HorizontalStackLayout>
</VerticalStackLayout>
</Frame>
<!-- Switch -->
<Frame Padding="15" CornerRadius="8">
<VerticalStackLayout Spacing="10">
<Label Text="Switch" FontAttributes="Bold" />
<HorizontalStackLayout Spacing="15">
<Switch x:Name="NotificationSwitch" Toggled="OnSwitchToggled" />
<Label Text="Enable Notifications" VerticalOptions="Center" />
</HorizontalStackLayout>
<Label x:Name="SwitchLabel" Text="Notifications: Off" TextColor="{StaticResource Gray500}" />
</VerticalStackLayout>
</Frame>
<!-- Styled Switches -->
<Frame Padding="15" CornerRadius="8">
<VerticalStackLayout Spacing="10">
<Label Text="Styled Switches" FontAttributes="Bold" />
<HorizontalStackLayout Spacing="20">
<Switch OnColor="{StaticResource Primary}" IsToggled="True" />
<Switch OnColor="#4CAF50" IsToggled="True" />
<Switch OnColor="#FF5722" IsToggled="True" />
</HorizontalStackLayout>
</VerticalStackLayout>
</Frame>
<!-- RadioButton -->
<Frame Padding="15" CornerRadius="8">
<VerticalStackLayout Spacing="10">
<Label Text="RadioButton Group" FontAttributes="Bold" />
<RadioButton Content="Option A" GroupName="Options" CheckedChanged="OnRadioButtonChecked" />
<RadioButton Content="Option B" GroupName="Options" CheckedChanged="OnRadioButtonChecked" />
<RadioButton Content="Option C" GroupName="Options" CheckedChanged="OnRadioButtonChecked" />
<Label x:Name="RadioLabel" Text="No option selected" TextColor="{StaticResource Gray500}" />
</VerticalStackLayout>
</Frame>
<!-- Settings Demo -->
<Frame Padding="15" CornerRadius="8" BackgroundColor="{StaticResource Secondary}">
<VerticalStackLayout Spacing="15">
<Label Text="Settings Demo" FontAttributes="Bold" FontSize="18" />
<Grid ColumnDefinitions="*,Auto">
<Label Text="Dark Mode" VerticalOptions="Center" />
<Switch Grid.Column="1" />
</Grid>
<Grid ColumnDefinitions="*,Auto">
<Label Text="Push Notifications" VerticalOptions="Center" />
<Switch Grid.Column="1" IsToggled="True" />
</Grid>
<Grid ColumnDefinitions="*,Auto">
<Label Text="Auto-Update" VerticalOptions="Center" />
<Switch Grid.Column="1" IsToggled="True" />
</Grid>
<Grid ColumnDefinitions="*,Auto">
<Label Text="Analytics" VerticalOptions="Center" />
<CheckBox Grid.Column="1" IsChecked="True" />
</Grid>
</VerticalStackLayout>
</Frame>
</VerticalStackLayout>
</ScrollView>
</ContentPage>