134 lines
6.0 KiB
XML
134 lines
6.0 KiB
XML
<UserControl
|
|
x:Class="Ursa.Demo.Pages.ToolBarDemo"
|
|
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"
|
|
xmlns:template="using:Ursa.Demo.Converters"
|
|
xmlns:u="https://irihi.tech/ursa"
|
|
xmlns:vm="using:Ursa.Demo.ViewModels"
|
|
d:DesignHeight="450"
|
|
d:DesignWidth="800"
|
|
x:CompileBindings="True"
|
|
x:DataType="vm:ToolBarDemoViewModel"
|
|
mc:Ignorable="d">
|
|
<Grid ColumnDefinitions="Auto, Auto, *" RowDefinitions="Auto, Auto, *">
|
|
<u:EnumSelector Name="Orientation" EnumType="Orientation" />
|
|
<u:ToolBar
|
|
DockPanel.Dock="Top"
|
|
Header="Hello World"
|
|
Orientation="{Binding #Orientation.Value}">
|
|
<Button u:ToolBar.OverflowMode="Never" Content="Button 1" />
|
|
<u:ToolBarSeparator />
|
|
<TextBox Width="100" VerticalAlignment="Center"></TextBox>
|
|
<StackPanel Orientation="Horizontal">
|
|
<RadioButton Content="A" VerticalAlignment="Center"></RadioButton>
|
|
<RadioButton Content="B" VerticalAlignment="Center"></RadioButton>
|
|
</StackPanel>
|
|
<Button u:ToolBar.OverflowMode="AsNeeded" Content="Button 2" />
|
|
<Button u:ToolBar.OverflowMode="AsNeeded" Content="Button 3" />
|
|
<ToggleButton Content="Toggle" />
|
|
<u:ToolBar.Styles>
|
|
<Style Selector="u|ToolBar[Orientation=Vertical]">
|
|
<Setter Property="Grid.Row" Value="1" />
|
|
<Setter Property="Grid.Column" Value="1" />
|
|
<Setter Property="Grid.RowSpan" Value="2" />
|
|
<Setter Property="Grid.ColumnSpan" Value="1" />
|
|
</Style>
|
|
<Style Selector="u|ToolBar[Orientation=Horizontal]">
|
|
<Setter Property="Grid.Row" Value="1" />
|
|
<Setter Property="Grid.Column" Value="1" />
|
|
<Setter Property="Grid.RowSpan" Value="1" />
|
|
<Setter Property="Grid.ColumnSpan" Value="3" />
|
|
</Style>
|
|
</u:ToolBar.Styles>
|
|
</u:ToolBar>
|
|
<u:ToolBar
|
|
DockPanel.Dock="Top"
|
|
ItemsSource="{Binding Items}"
|
|
Orientation="{Binding #Orientation.Value}">
|
|
<u:ToolBar.ItemTemplate>
|
|
<template:ToolBarItemTemplateSelector />
|
|
</u:ToolBar.ItemTemplate>
|
|
<u:ToolBar.Styles>
|
|
<Style Selector="u|ToolBar[Orientation=Vertical]">
|
|
<Setter Property="Grid.Row" Value="1" />
|
|
<Setter Property="Grid.Column" Value="0" />
|
|
<Setter Property="Grid.RowSpan" Value="2" />
|
|
<Setter Property="Grid.ColumnSpan" Value="1" />
|
|
</Style>
|
|
<Style Selector="u|ToolBar[Orientation=Horizontal]">
|
|
<Setter Property="Grid.Row" Value="0" />
|
|
<Setter Property="Grid.Column" Value="1" />
|
|
<Setter Property="Grid.RowSpan" Value="1" />
|
|
<Setter Property="Grid.ColumnSpan" Value="3" />
|
|
</Style>
|
|
</u:ToolBar.Styles>
|
|
</u:ToolBar>
|
|
<Grid
|
|
Grid.Row="2"
|
|
Grid.Column="2"
|
|
RowDefinitions="Auto, *">
|
|
<u:ToolBar Margin="16">
|
|
<ToggleButton Name="bold">
|
|
<PathIcon
|
|
Theme="{StaticResource InnerPathIcon}"
|
|
Data="{DynamicResource SemiIconBold}" />
|
|
</ToggleButton>
|
|
<ToggleButton Name="italic">
|
|
<PathIcon
|
|
Theme="{StaticResource InnerPathIcon}"
|
|
Data="{DynamicResource SemiIconItalic}" />
|
|
</ToggleButton>
|
|
<u:ToolBarSeparator />
|
|
<StackPanel Orientation="Horizontal">
|
|
<TextBlock
|
|
Margin="8,0"
|
|
HorizontalAlignment="Center"
|
|
VerticalAlignment="Center"
|
|
Text="Font Size" />
|
|
<ComboBox
|
|
Name="size"
|
|
Width="90"
|
|
SelectedIndex="0">
|
|
<x:Double>8</x:Double>
|
|
<x:Double>16</x:Double>
|
|
<x:Double>32</x:Double>
|
|
</ComboBox>
|
|
</StackPanel>
|
|
<u:ToolBar.Styles>
|
|
<Style Selector="u|ToolBar[Orientation=Horizontal]">
|
|
<Setter Property="Grid.Row" Value="2" />
|
|
<Setter Property="Grid.Column" Value="1" />
|
|
<Setter Property="Grid.RowSpan" Value="1" />
|
|
<Setter Property="Grid.ColumnSpan" Value="3" />
|
|
</Style>
|
|
</u:ToolBar.Styles>
|
|
|
|
</u:ToolBar>
|
|
<TextBlock
|
|
Grid.Row="1"
|
|
HorizontalAlignment="Center"
|
|
VerticalAlignment="Center"
|
|
Classes.Bold="{Binding #bold.IsChecked}"
|
|
Classes.Italic="{Binding #italic.IsChecked}"
|
|
FontSize="{Binding #size.SelectedItem}"
|
|
Text="Hello Ursa Avalonia">
|
|
<TextBlock.Styles>
|
|
<Style Selector="TextBlock">
|
|
<Setter Property="FontWeight" Value="Regular" />
|
|
<Setter Property="FontSize" Value="8" />
|
|
<Setter Property="FontStyle" Value="Normal" />
|
|
</Style>
|
|
<Style Selector="TextBlock.Bold">
|
|
<Setter Property="FontWeight" Value="Bold" />
|
|
</Style>
|
|
<Style Selector="TextBlock.Italic">
|
|
<Setter Property="FontStyle" Value="Italic" />
|
|
</Style>
|
|
</TextBlock.Styles>
|
|
</TextBlock>
|
|
</Grid>
|
|
</Grid>
|
|
</UserControl>
|