Commit 9edd1fc7 authored by shrabbit's avatar shrabbit
Browse files

拆分演示

parent 79b7154b
Loading
Loading
Loading
Loading
+71 −0
Original line number Diff line number Diff line
<UserControl xmlns="https://github.com/avaloniaui"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
             x:Class="Seek.Theme.Demo.Controls.DemoButtons">

    <ScrollViewer>
        <StackPanel Spacing="20" Margin="20">
            <TextBlock Text="Button Variants" FontSize="18" FontWeight="SemiBold" />
            <StackPanel Orientation="Horizontal" Spacing="12">
                <Button Content="Default" />
                <Button Content="Accent" />
                <Button Content="Disabled" IsEnabled="False" />
            </StackPanel>

            <TextBlock Text="Button Sizes" FontSize="18" FontWeight="SemiBold" />
            <StackPanel Orientation="Horizontal" Spacing="12" VerticalAlignment="Center">
                <Button Content="Small" Padding="8,4" FontSize="12" />
                <Button Content="Medium" />
                <Button Content="Large" Padding="16,12" FontSize="16" />
            </StackPanel>

            <TextBlock Text="Toggle Buttons" FontSize="18" FontWeight="SemiBold" />
            <StackPanel Orientation="Horizontal" Spacing="12">
                <ToggleButton Content="Toggle Me" />
                <ToggleButton Content="Toggled" IsChecked="True" />
            </StackPanel>

            <TextBlock Text="Split / DropDown Buttons" FontSize="18" FontWeight="SemiBold" />
            <StackPanel Orientation="Horizontal" Spacing="12">
                <SplitButton Content="Split" />
                <DropDownButton Content="Drop Down">
                    <DropDownButton.Flyout>
                        <MenuFlyout>
                            <MenuItem Header="Option 1" />
                            <MenuItem Header="Option 2" />
                            <Separator />
                            <MenuItem Header="Option 3" />
                        </MenuFlyout>
                    </DropDownButton.Flyout>
                </DropDownButton>
                <ToggleSplitButton Content="Toggle Split" />
            </StackPanel>

            <TextBlock Text="Other Button Types" FontSize="18" FontWeight="SemiBold" />
            <StackPanel Orientation="Horizontal" Spacing="12">
                <HyperlinkButton Content="Hyperlink" />
                <RepeatButton Content="Repeat (hold)" />
                <Button Content="With Flyout" ContextFlyout="{StaticResource DemoFlyout}" />
            </StackPanel>

            <TextBlock Text="Button with Icon" FontSize="18" FontWeight="SemiBold" />
            <StackPanel Orientation="Horizontal" Spacing="12">
                <Button>
                    <StackPanel Orientation="Horizontal" Spacing="8">
                        <PathIcon Data="M12 2L2 7l10 5 10-5-10-5zM2 17l10 5 10-5M2 12l10 5 10-5" Width="16"
                                  Height="16" />
                        <TextBlock Text="With Icon" />
                    </StackPanel>
                </Button>
                <Button Padding="8">
                    <PathIcon
                        Data="M3 12h1m8 0h1M6.3 6.3l.7.7m8.6 8.6l.7.7M6.3 17.7l.7-.7m8.6-8.6l.7-.7M12 2v1m0 18v1"
                        Width="16" Height="16" />
                </Button>
            </StackPanel>
        </StackPanel>
    </ScrollViewer>

</UserControl>
+11 −0
Original line number Diff line number Diff line
using Avalonia.Controls;

namespace Seek.Theme.Demo.Controls;

public partial class DemoButtons : UserControl
{
    public DemoButtons()
    {
        InitializeComponent();
    }
}
+36 −0
Original line number Diff line number Diff line
<UserControl xmlns="https://github.com/avaloniaui"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
             x:Class="Seek.Theme.Demo.Controls.DemoColors">

    <ScrollViewer>
        <StackPanel Spacing="20" Margin="20">
            <TextBlock Text="Semi Design Theme" FontSize="18" FontWeight="SemiBold" />
            <TextBlock
                Text="The Semi theme provides a comprehensive design system. Switch between Light and Dark modes to see the adaptive colors."
                TextWrapping="Wrap" />

            <TextBlock Text="Theme Switcher" FontSize="18" FontWeight="SemiBold" />
            <StackPanel Orientation="Horizontal" Spacing="12">
                <Button Content="Light" Click="SwitchToLight" />
                <Button Content="Dark" Click="SwitchToDark" />
                <Button Content="Follow System" Click="SwitchToDefault" />
            </StackPanel>

            <TextBlock Text="Theme-aware Controls" FontSize="18" FontWeight="SemiBold" />
            <StackPanel Spacing="12">
                <Border Padding="16" BorderThickness="1" CornerRadius="8">
                    <TextBlock Text="This card adapts to the current theme" />
                </Border>
                <TextBox Text="This textbox adapts to the current theme" />
                <ProgressBar Value="60" Maximum="100" />
            </StackPanel>

            <TextBlock Text="ColorPicker" FontSize="18" FontWeight="SemiBold" />
            <ColorPicker />
        </StackPanel>
    </ScrollViewer>

</UserControl>
+40 −0
Original line number Diff line number Diff line
using Avalonia;
using Avalonia.Controls;
using Avalonia.Interactivity;
using Avalonia.Styling;

namespace Seek.Theme.Demo.Controls;

public partial class DemoColors : UserControl
{
    private TopLevel? _top;

    public DemoColors()
    {
        InitializeComponent();
    }

    protected override void OnAttachedToVisualTree(VisualTreeAttachmentEventArgs e)
    {
        _top = TopLevel.GetTopLevel(this);
        base.OnAttachedToVisualTree(e);
    }

    private void SwitchToLight(object? sender, RoutedEventArgs e)
    {
        if (_top != null)
            _top.RequestedThemeVariant = ThemeVariant.Light;
    }

    private void SwitchToDark(object? sender, RoutedEventArgs e)
    {
        if (_top != null)
            _top.RequestedThemeVariant = ThemeVariant.Dark;
    }

    private void SwitchToDefault(object? sender, RoutedEventArgs e)
    {
        if (_top != null)
            _top.RequestedThemeVariant = ThemeVariant.Default;
    }
}
+79 −0
Original line number Diff line number Diff line
<UserControl xmlns="https://github.com/avaloniaui"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
             x:Class="Seek.Theme.Demo.Controls.DemoContainers">

    <ScrollViewer>
        <StackPanel Spacing="20" Margin="20">
            <TextBlock Text="Expander" FontSize="18" FontWeight="SemiBold" />
            <Expander Header="Click to expand">
                <TextBlock
                    Text="This is the expanded content. It can contain any controls or content you need."
                    TextWrapping="Wrap" Margin="0,8,0,0" />
            </Expander>
            <Expander Header="Another expander" IsExpanded="True">
                <StackPanel Spacing="8" Margin="0,8,0,0">
                    <TextBlock Text="This one starts expanded." />
                    <TextBox Watermark="You can put inputs here..." />
                    <Button Content="Action" />
                </StackPanel>
            </Expander>
            <Expander Header="Disabled expander" IsEnabled="False" />

            <TextBlock Text="TabControl (Nested)" FontSize="18" FontWeight="SemiBold" />
            <TabControl>
                <TabItem Header="Tab A">
                    <TextBlock Text="Content for Tab A" Margin="16" />
                </TabItem>
                <TabItem Header="Tab B">
                    <TextBlock Text="Content for Tab B" Margin="16" />
                </TabItem>
                <TabItem Header="Tab C">
                    <TextBlock Text="Content for Tab C" Margin="16" />
                </TabItem>
            </TabControl>

            <TextBlock Text="TabControl (Bottom)" FontSize="18" FontWeight="SemiBold" />
            <TabControl TabStripPlacement="Bottom">
                <TabItem Header="Bottom 1">
                    <TextBlock Text="Tab strip at bottom" Margin="16" />
                </TabItem>
                <TabItem Header="Bottom 2">
                    <TextBlock Text="Another tab" Margin="16" />
                </TabItem>
            </TabControl>

            <TextBlock Text="TabControl (Left)" FontSize="18" FontWeight="SemiBold" />
            <TabControl TabStripPlacement="Left">
                <TabItem Header="Left 1">
                    <TextBlock Text="Tab strip at left" Margin="16" />
                </TabItem>
                <TabItem Header="Left 2">
                    <TextBlock Text="Another tab" Margin="16" />
                </TabItem>
            </TabControl>

            <TextBlock Text="TabControl (Right)" FontSize="18" FontWeight="SemiBold" />
            <TabControl TabStripPlacement="Right">
                <TabItem Header="Right 1">
                    <TextBlock Text="Tab strip at right" Margin="16" />
                </TabItem>
                <TabItem Header="Right 2">
                    <TextBlock Text="Another tab" Margin="16" />
                </TabItem>
            </TabControl>

            <TextBlock Text="Border / Card" FontSize="18" FontWeight="SemiBold" />
            <Border Padding="16" BorderThickness="1" CornerRadius="8">
                <StackPanel Spacing="8">
                    <TextBlock Text="Card Title" FontSize="16" FontWeight="SemiBold" />
                    <TextBlock Text="This is a card-like container using Border with Semi theme styling."
                               TextWrapping="Wrap" />
                </StackPanel>
            </Border>
        </StackPanel>
    </ScrollViewer>

</UserControl>
Loading