Feat: add a new control PathPicker, add PathPickerDemo
This commit is contained in:
66
src/Ursa.Themes.Semi/Controls/PathPicker.axaml
Normal file
66
src/Ursa.Themes.Semi/Controls/PathPicker.axaml
Normal file
@@ -0,0 +1,66 @@
|
||||
<ResourceDictionary xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:ursa="https://irihi.tech/ursa">
|
||||
<ControlTheme x:Key="{x:Type ursa:PathPicker}" TargetType="ursa:PathPicker">
|
||||
<Setter Property="Template">
|
||||
<ControlTemplate>
|
||||
<DockPanel HorizontalAlignment="{TemplateBinding HorizontalAlignment}"
|
||||
VerticalAlignment="{TemplateBinding VerticalAlignment}">
|
||||
<Button Name="PART_Button"
|
||||
DockPanel.Dock="Right"
|
||||
Content="{TemplateBinding Title}"
|
||||
Command="{TemplateBinding Command}"
|
||||
Margin="1,0,0,0">
|
||||
</Button>
|
||||
<TextBox DockPanel.Dock="Left"
|
||||
Text="{TemplateBinding SelectedPath,Mode=TwoWay}">
|
||||
</TextBox>
|
||||
</DockPanel>
|
||||
</ControlTemplate>
|
||||
</Setter>
|
||||
</ControlTheme>
|
||||
|
||||
<ControlTheme x:Key="PathPickerOnlyButton" TargetType="ursa:PathPicker">
|
||||
<Setter Property="Template">
|
||||
<ControlTemplate>
|
||||
<Button Name="PART_Button"
|
||||
HorizontalAlignment="{TemplateBinding HorizontalAlignment}"
|
||||
VerticalAlignment="{TemplateBinding VerticalAlignment}"
|
||||
Content="{TemplateBinding Title}"
|
||||
Command="{TemplateBinding Command}">
|
||||
</Button>
|
||||
</ControlTemplate>
|
||||
</Setter>
|
||||
</ControlTheme>
|
||||
|
||||
<ControlTheme x:Key="PathPickerForList" TargetType="ursa:PathPicker">
|
||||
<Setter Property="Template">
|
||||
<ControlTemplate>
|
||||
<Expander HorizontalAlignment="{TemplateBinding HorizontalAlignment}"
|
||||
VerticalAlignment="{TemplateBinding VerticalAlignment}">
|
||||
<Expander.Header>
|
||||
<Button Name="PART_Button"
|
||||
HorizontalAlignment="Stretch"
|
||||
Content="{TemplateBinding Title}"
|
||||
Command="{TemplateBinding Command}">
|
||||
<Button.Theme>
|
||||
<ControlTheme TargetType="Button">
|
||||
<Setter Property="Template">
|
||||
<ControlTemplate>
|
||||
<TextPresenter Text="{TemplateBinding Content}"
|
||||
Background="Transparent"
|
||||
HorizontalAlignment="Stretch"
|
||||
VerticalAlignment="Stretch">
|
||||
</TextPresenter>
|
||||
</ControlTemplate>
|
||||
</Setter>
|
||||
</ControlTheme>
|
||||
</Button.Theme>
|
||||
</Button>
|
||||
</Expander.Header>
|
||||
<ListBox ItemsSource="{TemplateBinding SelectedPaths}"></ListBox>
|
||||
</Expander>
|
||||
</ControlTemplate>
|
||||
</Setter>
|
||||
</ControlTheme>
|
||||
</ResourceDictionary>
|
||||
@@ -55,5 +55,6 @@
|
||||
<ResourceInclude Source="UrsaView.axaml" />
|
||||
<ResourceInclude Source="UrsaWindow.axaml"/>
|
||||
<ResourceInclude Source="PinCode.axaml" />
|
||||
<ResourceInclude Source="PathPicker.axaml"/>
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
</ResourceDictionary>
|
||||
|
||||
Reference in New Issue
Block a user