commit
4803f0e65a
@ -8,20 +8,26 @@
|
|||||||
d:DesignWidth="800"
|
d:DesignWidth="800"
|
||||||
mc:Ignorable="d">
|
mc:Ignorable="d">
|
||||||
<UserControl.Styles>
|
<UserControl.Styles>
|
||||||
<Style Selector="Border">
|
<Style Selector="Carousel">
|
||||||
<Setter Property="Height" Value="200" />
|
<Setter Property="Height" Value="200" />
|
||||||
|
<Style Selector="^ TextBlock">
|
||||||
|
<Setter Property="HorizontalAlignment" Value="Center" />
|
||||||
|
<Setter Property="VerticalAlignment" Value="Center" />
|
||||||
|
<Setter Property="Foreground" Value="#1C1F23" />
|
||||||
|
</Style>
|
||||||
</Style>
|
</Style>
|
||||||
<Style Selector="TextBlock">
|
<Style Selector="RadioButton">
|
||||||
<Setter Property="HorizontalAlignment" Value="Center" />
|
<Setter Property="Theme" Value="{DynamicResource ButtonRadioButton}" />
|
||||||
<Setter Property="VerticalAlignment" Value="Center" />
|
|
||||||
<Setter Property="Foreground" Value="#1C1F23" />
|
|
||||||
</Style>
|
</Style>
|
||||||
</UserControl.Styles>
|
</UserControl.Styles>
|
||||||
<StackPanel Spacing="20">
|
<StackPanel Spacing="20">
|
||||||
<Carousel Theme="{DynamicResource FullCarousel}">
|
<Carousel Theme="{DynamicResource FullCarousel}"
|
||||||
<Carousel.PageTransition>
|
Classes.Dot="{Binding #DotButton.IsChecked}"
|
||||||
<PageSlide Orientation="Horizontal" Duration="0.25" />
|
Classes.Columnar="{Binding #ColumnarButton.IsChecked}"
|
||||||
</Carousel.PageTransition>
|
Classes.Line="{Binding #LineButton.IsChecked}"
|
||||||
|
Classes.Left="{Binding #LeftButton.IsChecked}"
|
||||||
|
Classes.Center="{Binding #CenterButton.IsChecked}"
|
||||||
|
Classes.Right="{Binding #RightButton.IsChecked}">
|
||||||
<Border Background="#EAF5FF">
|
<Border Background="#EAF5FF">
|
||||||
<TextBlock Text="Text 1" />
|
<TextBlock Text="Text 1" />
|
||||||
</Border>
|
</Border>
|
||||||
@ -35,39 +41,39 @@
|
|||||||
<TextBlock Text="Text 4" />
|
<TextBlock Text="Text 4" />
|
||||||
</Border>
|
</Border>
|
||||||
</Carousel>
|
</Carousel>
|
||||||
<Carousel Classes="Line" Theme="{DynamicResource FullCarousel}">
|
<StackPanel Orientation="Horizontal" Spacing="8">
|
||||||
<Carousel.PageTransition>
|
<TextBlock VerticalAlignment="Center" Text="Type" />
|
||||||
<PageSlide Orientation="Horizontal" Duration="0.25" />
|
<Border Theme="{DynamicResource RadioButtonGroupBorder}">
|
||||||
</Carousel.PageTransition>
|
<StackPanel Orientation="Horizontal">
|
||||||
<Border Background="#EAF5FF">
|
<RadioButton
|
||||||
<TextBlock Text="Text 1" />
|
Name="DotButton"
|
||||||
|
IsChecked="True"
|
||||||
|
Content="Dot" />
|
||||||
|
<RadioButton
|
||||||
|
Name="ColumnarButton"
|
||||||
|
Content="Columnar" />
|
||||||
|
<RadioButton
|
||||||
|
Name="LineButton"
|
||||||
|
Content="Line" />
|
||||||
|
</StackPanel>
|
||||||
</Border>
|
</Border>
|
||||||
<Border Background="#F9F9F9">
|
</StackPanel>
|
||||||
<TextBlock Text="Text 2" />
|
<StackPanel Orientation="Horizontal" Spacing="8">
|
||||||
|
<TextBlock VerticalAlignment="Center" Text="Position" />
|
||||||
|
<Border Theme="{DynamicResource RadioButtonGroupBorder}">
|
||||||
|
<StackPanel Orientation="Horizontal">
|
||||||
|
<RadioButton
|
||||||
|
Name="LeftButton"
|
||||||
|
IsChecked="True"
|
||||||
|
Content="Left" />
|
||||||
|
<RadioButton
|
||||||
|
Name="CenterButton"
|
||||||
|
Content="Center" />
|
||||||
|
<RadioButton
|
||||||
|
Name="RightButton"
|
||||||
|
Content="Right" />
|
||||||
|
</StackPanel>
|
||||||
</Border>
|
</Border>
|
||||||
<Border Background="#FFF8EA">
|
</StackPanel>
|
||||||
<TextBlock Text="Text 3" />
|
|
||||||
</Border>
|
|
||||||
<Border Background="#FEF2ED">
|
|
||||||
<TextBlock Text="Text 4" />
|
|
||||||
</Border>
|
|
||||||
</Carousel>
|
|
||||||
<Carousel Classes="Columnar Left" Theme="{DynamicResource FullCarousel}">
|
|
||||||
<Carousel.PageTransition>
|
|
||||||
<PageSlide Orientation="Horizontal" Duration="0.25" />
|
|
||||||
</Carousel.PageTransition>
|
|
||||||
<Border Background="#EAF5FF">
|
|
||||||
<TextBlock Text="Text 1" />
|
|
||||||
</Border>
|
|
||||||
<Border Background="#F9F9F9">
|
|
||||||
<TextBlock Text="Text 2" />
|
|
||||||
</Border>
|
|
||||||
<Border Background="#FFF8EA">
|
|
||||||
<TextBlock Text="Text 3" />
|
|
||||||
</Border>
|
|
||||||
<Border Background="#FEF2ED">
|
|
||||||
<TextBlock Text="Text 4" />
|
|
||||||
</Border>
|
|
||||||
</Carousel>
|
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</UserControl>
|
</UserControl>
|
@ -1,9 +1,66 @@
|
|||||||
<ResourceDictionary
|
<ResourceDictionary
|
||||||
xmlns="https://github.com/avaloniaui"
|
xmlns="https://github.com/avaloniaui"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:converters="clr-namespace:Semi.Avalonia.Converters"
|
xmlns:converter="clr-namespace:Semi.Avalonia.Converters"
|
||||||
x:CompileBindings="True">
|
x:CompileBindings="True">
|
||||||
<converters:ItemToObjectConverter x:Key="ItemsConverter" />
|
<Design.PreviewWith>
|
||||||
|
<StackPanel Spacing="20" Width="800" Height="800">
|
||||||
|
<StackPanel.Styles>
|
||||||
|
<Style Selector="Carousel">
|
||||||
|
<Setter Property="Height" Value="200" />
|
||||||
|
</Style>
|
||||||
|
<Style Selector="TextBlock">
|
||||||
|
<Setter Property="HorizontalAlignment" Value="Center" />
|
||||||
|
<Setter Property="VerticalAlignment" Value="Center" />
|
||||||
|
<Setter Property="Foreground" Value="#1C1F23" />
|
||||||
|
</Style>
|
||||||
|
</StackPanel.Styles>
|
||||||
|
<Carousel Theme="{DynamicResource FullCarousel}">
|
||||||
|
<Border Background="#EAF5FF">
|
||||||
|
<TextBlock Text="Text 1" />
|
||||||
|
</Border>
|
||||||
|
<Border Background="#F9F9F9">
|
||||||
|
<TextBlock Text="Text 2" />
|
||||||
|
</Border>
|
||||||
|
<Border Background="#FFF8EA">
|
||||||
|
<TextBlock Text="Text 3" />
|
||||||
|
</Border>
|
||||||
|
<Border Background="#FEF2ED">
|
||||||
|
<TextBlock Text="Text 4" />
|
||||||
|
</Border>
|
||||||
|
</Carousel>
|
||||||
|
<Carousel Theme="{DynamicResource FullCarousel}"
|
||||||
|
Classes="Line">
|
||||||
|
<Border Background="#EAF5FF">
|
||||||
|
<TextBlock Text="Text 1" />
|
||||||
|
</Border>
|
||||||
|
<Border Background="#F9F9F9">
|
||||||
|
<TextBlock Text="Text 2" />
|
||||||
|
</Border>
|
||||||
|
<Border Background="#FFF8EA">
|
||||||
|
<TextBlock Text="Text 3" />
|
||||||
|
</Border>
|
||||||
|
<Border Background="#FEF2ED">
|
||||||
|
<TextBlock Text="Text 4" />
|
||||||
|
</Border>
|
||||||
|
</Carousel>
|
||||||
|
<Carousel Theme="{DynamicResource FullCarousel}"
|
||||||
|
Classes="Columnar Left">
|
||||||
|
<Border Background="#EAF5FF">
|
||||||
|
<TextBlock Text="Text 1" />
|
||||||
|
</Border>
|
||||||
|
<Border Background="#F9F9F9">
|
||||||
|
<TextBlock Text="Text 2" />
|
||||||
|
</Border>
|
||||||
|
<Border Background="#FFF8EA">
|
||||||
|
<TextBlock Text="Text 3" />
|
||||||
|
</Border>
|
||||||
|
<Border Background="#FEF2ED">
|
||||||
|
<TextBlock Text="Text 4" />
|
||||||
|
</Border>
|
||||||
|
</Carousel>
|
||||||
|
</StackPanel>
|
||||||
|
</Design.PreviewWith>
|
||||||
<ControlTheme x:Key="{x:Type Carousel}" TargetType="Carousel">
|
<ControlTheme x:Key="{x:Type Carousel}" TargetType="Carousel">
|
||||||
<Setter Property="Template">
|
<Setter Property="Template">
|
||||||
<ControlTemplate>
|
<ControlTemplate>
|
||||||
@ -25,124 +82,94 @@
|
|||||||
</ControlTheme>
|
</ControlTheme>
|
||||||
|
|
||||||
<ControlTheme x:Key="CarouselIndicatorDotListBoxItem" TargetType="ListBoxItem">
|
<ControlTheme x:Key="CarouselIndicatorDotListBoxItem" TargetType="ListBoxItem">
|
||||||
<!-- Use fit in different color themes, Use Foreground to normal, Background to hover, BorderBrush to Selected -->
|
|
||||||
<Setter Property="Cursor" Value="Hand" />
|
|
||||||
<Setter Property="Foreground" Value="{DynamicResource CarouselIndicatorForeground}" />
|
<Setter Property="Foreground" Value="{DynamicResource CarouselIndicatorForeground}" />
|
||||||
|
<Setter Property="Margin" Value="4 0"/>
|
||||||
|
<Setter Property="Cursor" Value="Hand" />
|
||||||
<Setter Property="Template">
|
<Setter Property="Template">
|
||||||
<ControlTemplate TargetType="ListBoxItem">
|
<ControlTemplate TargetType="ListBoxItem">
|
||||||
<Panel>
|
<Ellipse
|
||||||
<Border Padding="4" Background="Transparent">
|
Name="Container"
|
||||||
<Ellipse
|
Width="{DynamicResource CarouselIndicatorDotWidth}"
|
||||||
Name="Container"
|
Height="{DynamicResource CarouselIndicatorDotHeight}"
|
||||||
Width="{DynamicResource CarouselIndicatorWidth}"
|
Fill="{TemplateBinding Foreground}" />
|
||||||
Height="{DynamicResource CarouselIndicatorHeight}"
|
|
||||||
HorizontalAlignment="Center"
|
|
||||||
VerticalAlignment="Center"
|
|
||||||
Fill="{TemplateBinding Foreground}" />
|
|
||||||
</Border>
|
|
||||||
</Panel>
|
|
||||||
</ControlTemplate>
|
</ControlTemplate>
|
||||||
</Setter>
|
</Setter>
|
||||||
<Style Selector="^:pointerover /template/ Ellipse#Container">
|
<Style Selector="^:pointerover">
|
||||||
<Setter Property="Fill" Value="{DynamicResource CarouselIndicatorPointeroverForeground}" />
|
<Setter Property="Foreground" Value="{DynamicResource CarouselIndicatorPointeroverForeground}" />
|
||||||
</Style>
|
</Style>
|
||||||
<Style Selector="^:pressed /template/ Ellipse#Container">
|
<Style Selector="^:pressed">
|
||||||
<Setter Property="Fill" Value="{DynamicResource CarouselIndicatorPressedForeground}" />
|
<Setter Property="Foreground" Value="{DynamicResource CarouselIndicatorPressedForeground}" />
|
||||||
</Style>
|
</Style>
|
||||||
<Style Selector="^:selected /template/ Ellipse#Container">
|
<Style Selector="^:selected">
|
||||||
<Setter Property="Fill" Value="{DynamicResource CarouselIndicatorSelectedForeground}" />
|
<Setter Property="Foreground" Value="{DynamicResource CarouselIndicatorSelectedForeground}" />
|
||||||
</Style>
|
</Style>
|
||||||
</ControlTheme>
|
</ControlTheme>
|
||||||
|
|
||||||
<ControlTheme x:Key="CarouselIndicatorLineListBoxItem" TargetType="ListBoxItem">
|
<ControlTheme x:Key="CarouselIndicatorLineListBoxItem"
|
||||||
<!-- Use fit in different color themes, Use Foreground to normal, Background to hover, BorderBrush to Selected -->
|
BasedOn="{StaticResource CarouselIndicatorDotListBoxItem}"
|
||||||
<Setter Property="Cursor" Value="Hand" />
|
TargetType="ListBoxItem">
|
||||||
<Setter Property="Background" Value="{DynamicResource CarouselIndicatorForeground}" />
|
<Setter Property="Margin" Value="2 0"/>
|
||||||
<Setter Property="Template">
|
<Setter Property="Template">
|
||||||
<ControlTemplate TargetType="ListBoxItem">
|
<ControlTemplate TargetType="ListBoxItem">
|
||||||
<Panel Background="Transparent">
|
<Rectangle
|
||||||
<Border Padding="2,0" Background="Transparent">
|
Name="Container"
|
||||||
<Border
|
Height="{DynamicResource CarouselIndicatorLineHeight}"
|
||||||
Name="Container"
|
Fill="{TemplateBinding Foreground}" />
|
||||||
Width="{DynamicResource CarouselIndicatorLineWidth}"
|
|
||||||
Height="{DynamicResource CarouselIndicatorLineHeight}"
|
|
||||||
Background="{TemplateBinding Background}" />
|
|
||||||
</Border>
|
|
||||||
</Panel>
|
|
||||||
</ControlTemplate>
|
</ControlTemplate>
|
||||||
</Setter>
|
</Setter>
|
||||||
<Style Selector="^:pointerover /template/ Border#Container">
|
|
||||||
<Setter Property="Background" Value="{DynamicResource CarouselIndicatorPointeroverForeground}" />
|
|
||||||
</Style>
|
|
||||||
<Style Selector="^:pressed /template/ Border#Container">
|
|
||||||
<Setter Property="Background" Value="{DynamicResource CarouselIndicatorPressedForeground}" />
|
|
||||||
</Style>
|
|
||||||
<Style Selector="^:selected /template/ Border#Container">
|
|
||||||
<Setter Property="Background" Value="{DynamicResource CarouselIndicatorSelectedForeground}" />
|
|
||||||
</Style>
|
|
||||||
</ControlTheme>
|
</ControlTheme>
|
||||||
|
|
||||||
<ControlTheme x:Key="CarouselIndicatorColumnarListBoxItem" TargetType="ListBoxItem">
|
<ControlTheme x:Key="CarouselIndicatorColumnarListBoxItem"
|
||||||
<Setter Property="Cursor" Value="Hand" />
|
BasedOn="{StaticResource CarouselIndicatorDotListBoxItem}"
|
||||||
<Setter Property="Background" Value="{DynamicResource CarouselIndicatorForeground}" />
|
TargetType="ListBoxItem">
|
||||||
|
<Setter Property="Width" Value="{DynamicResource CarouselIndicatorColumnarWidth}"/>
|
||||||
|
<Setter Property="Height" Value="{DynamicResource CarouselIndicatorColumnarSelectedHeight}"/>
|
||||||
|
<Setter Property="Margin" Value="2 0"/>
|
||||||
<Setter Property="Template">
|
<Setter Property="Template">
|
||||||
<ControlTemplate TargetType="ListBoxItem">
|
<ControlTemplate TargetType="ListBoxItem">
|
||||||
<Panel Background="Transparent">
|
<Rectangle
|
||||||
<Border Padding="2,0" Background="Transparent">
|
Name="Container"
|
||||||
<Border Width="{DynamicResource CarouselIndicatorColumnarWidth}" Height="{DynamicResource CarouselIndicatorColumnarSelectedHeight}">
|
Width="{DynamicResource CarouselIndicatorColumnarWidth}"
|
||||||
<Rectangle
|
Height="{DynamicResource CarouselIndicatorColumnarHeight}"
|
||||||
Name="Container"
|
VerticalAlignment="Bottom"
|
||||||
Width="{DynamicResource CarouselIndicatorColumnarWidth}"
|
Fill="{TemplateBinding Foreground}">
|
||||||
Height="{DynamicResource CarouselIndicatorColumnarHeight}"
|
<Rectangle.Transitions>
|
||||||
VerticalAlignment="Bottom"
|
<Transitions>
|
||||||
Fill="{TemplateBinding Background}">
|
<DoubleTransition Property="Height" Duration="0:0:0.2" />
|
||||||
<Rectangle.Transitions>
|
</Transitions>
|
||||||
<Transitions>
|
</Rectangle.Transitions>
|
||||||
<DoubleTransition Property="Height" Duration="0:0:0.2" />
|
</Rectangle>
|
||||||
</Transitions>
|
|
||||||
</Rectangle.Transitions>
|
|
||||||
</Rectangle>
|
|
||||||
</Border>
|
|
||||||
</Border>
|
|
||||||
</Panel>
|
|
||||||
</ControlTemplate>
|
</ControlTemplate>
|
||||||
</Setter>
|
</Setter>
|
||||||
<Style Selector="^:pointerover /template/ Rectangle#Container">
|
|
||||||
<Setter Property="Fill" Value="{DynamicResource CarouselIndicatorPointeroverForeground}" />
|
|
||||||
</Style>
|
|
||||||
<Style Selector="^:pressed /template/ Rectangle#Container">
|
|
||||||
<Setter Property="Fill" Value="{DynamicResource CarouselIndicatorPressedForeground}" />
|
|
||||||
</Style>
|
|
||||||
<Style Selector="^:selected /template/ Rectangle#Container">
|
<Style Selector="^:selected /template/ Rectangle#Container">
|
||||||
<Setter Property="Fill" Value="{DynamicResource CarouselIndicatorSelectedForeground}" />
|
|
||||||
<Setter Property="Height" Value="{DynamicResource CarouselIndicatorColumnarSelectedHeight}" />
|
<Setter Property="Height" Value="{DynamicResource CarouselIndicatorColumnarSelectedHeight}" />
|
||||||
</Style>
|
</Style>
|
||||||
</ControlTheme>
|
</ControlTheme>
|
||||||
|
|
||||||
<ControlTheme x:Key="CarouselButton" TargetType="Button">
|
<ControlTheme x:Key="CarouselButton" TargetType="Button">
|
||||||
<Setter Property="Cursor" Value="Hand" />
|
<Setter Property="Width" Value="32" />
|
||||||
|
<Setter Property="Height" Value="32" />
|
||||||
<Setter Property="Foreground" Value="{DynamicResource CarouselButtonForeground}" />
|
<Setter Property="Foreground" Value="{DynamicResource CarouselButtonForeground}" />
|
||||||
|
<Setter Property="Cursor" Value="Hand" />
|
||||||
<Setter Property="Template">
|
<Setter Property="Template">
|
||||||
<ControlTemplate TargetType="Button">
|
<ControlTemplate TargetType="Button">
|
||||||
<Grid Background="Transparent">
|
<PathIcon
|
||||||
<PathIcon
|
Theme="{DynamicResource InnerPathIcon}"
|
||||||
Theme="{DynamicResource InnerPathIcon}"
|
Width="{TemplateBinding Width}"
|
||||||
Width="32"
|
Height="{TemplateBinding Height}"
|
||||||
Height="32"
|
Data="{DynamicResource CarouselButtonGlyph}"
|
||||||
Data="{DynamicResource CarouselButtonGlyph}"
|
Foreground="{TemplateBinding Foreground}" />
|
||||||
Foreground="{TemplateBinding Foreground}" />
|
|
||||||
</Grid>
|
|
||||||
</ControlTemplate>
|
</ControlTemplate>
|
||||||
</Setter>
|
</Setter>
|
||||||
<Style Selector="^:pointerover /template/ PathIcon">
|
<Style Selector="^:pointerover /template/ PathIcon">
|
||||||
<Setter Property="Foreground" Value="{DynamicResource CarouselButtonPointeroverForeground}" />
|
<Setter Property="Foreground" Value="{DynamicResource CarouselButtonPointeroverForeground}" />
|
||||||
</Style>
|
</Style>
|
||||||
<Style Selector="^:pointerover /template/ PathIcon">
|
|
||||||
<Setter Property="Foreground" Value="{DynamicResource CarouselButtonPressedForeground}" />
|
|
||||||
</Style>
|
|
||||||
</ControlTheme>
|
</ControlTheme>
|
||||||
|
|
||||||
<ControlTheme x:Key="FullCarousel" TargetType="Carousel">
|
<ControlTheme x:Key="FullCarousel" TargetType="Carousel">
|
||||||
|
<Setter Property="PageTransition">
|
||||||
|
<PageSlide Orientation="Horizontal" Duration="0.3" />
|
||||||
|
</Setter>
|
||||||
<Setter Property="Template">
|
<Setter Property="Template">
|
||||||
<ControlTemplate TargetType="Carousel">
|
<ControlTemplate TargetType="Carousel">
|
||||||
<Grid ColumnDefinitions="Auto, *, Auto" RowDefinitions="*, Auto">
|
<Grid ColumnDefinitions="Auto, *, Auto" RowDefinitions="*, Auto">
|
||||||
@ -165,16 +192,15 @@
|
|||||||
<ListBox
|
<ListBox
|
||||||
Name="PART_ItemsPresenter2"
|
Name="PART_ItemsPresenter2"
|
||||||
Grid.Row="1"
|
Grid.Row="1"
|
||||||
Grid.Column="1"
|
Grid.Column="0"
|
||||||
MaxHeight="30"
|
Grid.ColumnSpan="3"
|
||||||
Margin="0,8"
|
Margin="32"
|
||||||
HorizontalAlignment="Center"
|
HorizontalAlignment="Center"
|
||||||
VerticalAlignment="Center"
|
VerticalAlignment="Center"
|
||||||
ItemContainerTheme="{DynamicResource CarouselIndicatorDotListBoxItem}"
|
ItemContainerTheme="{DynamicResource CarouselIndicatorDotListBoxItem}"
|
||||||
ItemsSource="{TemplateBinding ItemCount,
|
ItemsSource="{TemplateBinding ItemCount, Converter={x:Static converter:ItemConverter.ItemToObjectConverter}}"
|
||||||
Mode=OneWay,
|
IsVisible="{TemplateBinding ItemCount, Converter={x:Static converter:ItemConverter.ItemVisibleConverter}}"
|
||||||
Converter={StaticResource ItemsConverter}}"
|
SelectedIndex="{TemplateBinding SelectedIndex, Mode=TwoWay}">
|
||||||
SelectedIndex="{Binding SelectedIndex, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}">
|
|
||||||
<ListBox.ItemsPanel>
|
<ListBox.ItemsPanel>
|
||||||
<ItemsPanelTemplate>
|
<ItemsPanelTemplate>
|
||||||
<StackPanel Orientation="Horizontal" />
|
<StackPanel Orientation="Horizontal" />
|
||||||
@ -185,30 +211,31 @@
|
|||||||
Grid.Row="0"
|
Grid.Row="0"
|
||||||
Grid.RowSpan="2"
|
Grid.RowSpan="2"
|
||||||
Grid.Column="0"
|
Grid.Column="0"
|
||||||
|
Theme="{DynamicResource CarouselButton}"
|
||||||
Margin="{DynamicResource CarouselButtonMargin}"
|
Margin="{DynamicResource CarouselButtonMargin}"
|
||||||
VerticalAlignment="Center"
|
|
||||||
Background="{DynamicResource CarouselButtonPointeroverForeground}"
|
|
||||||
BorderBrush="{DynamicResource CarouselButtonPressedForeground}"
|
|
||||||
Command="{Binding $parent[Carousel].Previous}"
|
|
||||||
Foreground="{DynamicResource CarouselButtonForeground}"
|
Foreground="{DynamicResource CarouselButtonForeground}"
|
||||||
Theme="{DynamicResource CarouselButton}" />
|
IsVisible="{TemplateBinding ItemCount, Converter={x:Static converter:ItemConverter.ItemVisibleConverter}}"
|
||||||
|
Command="{Binding $parent[Carousel].Previous}" />
|
||||||
<Button
|
<Button
|
||||||
Grid.Row="0"
|
Grid.Row="0"
|
||||||
Grid.RowSpan="2"
|
Grid.RowSpan="2"
|
||||||
Grid.Column="2"
|
Grid.Column="2"
|
||||||
|
Theme="{DynamicResource CarouselButton}"
|
||||||
Margin="{DynamicResource CarouselButtonMargin}"
|
Margin="{DynamicResource CarouselButtonMargin}"
|
||||||
VerticalAlignment="Center"
|
|
||||||
Background="{DynamicResource CarouselButtonPointeroverForeground}"
|
|
||||||
BorderBrush="{DynamicResource CarouselButtonPressedForeground}"
|
|
||||||
Command="{Binding $parent[Carousel].Next}"
|
|
||||||
Foreground="{DynamicResource CarouselButtonForeground}"
|
Foreground="{DynamicResource CarouselButtonForeground}"
|
||||||
RenderTransform="rotate(180deg)"
|
IsVisible="{TemplateBinding ItemCount, Converter={x:Static converter:ItemConverter.ItemVisibleConverter}}"
|
||||||
Theme="{DynamicResource CarouselButton}" />
|
Command="{Binding $parent[Carousel].Next}"
|
||||||
|
RenderTransform="rotate(180deg)" />
|
||||||
</Grid>
|
</Grid>
|
||||||
</ControlTemplate>
|
</ControlTemplate>
|
||||||
</Setter>
|
</Setter>
|
||||||
<Style Selector="^.Line /template/ ListBox#PART_ItemsPresenter2">
|
<Style Selector="^.Line /template/ ListBox#PART_ItemsPresenter2">
|
||||||
<Setter Property="ItemContainerTheme" Value="{DynamicResource CarouselIndicatorLineListBoxItem}" />
|
<Setter Property="ItemContainerTheme" Value="{DynamicResource CarouselIndicatorLineListBoxItem}" />
|
||||||
|
<Setter Property="ItemsPanel">
|
||||||
|
<ItemsPanelTemplate>
|
||||||
|
<UniformGrid Columns="{TemplateBinding ItemCount}" Rows="1" Width="240" />
|
||||||
|
</ItemsPanelTemplate>
|
||||||
|
</Setter>
|
||||||
</Style>
|
</Style>
|
||||||
<Style Selector="^.Columnar /template/ ListBox#PART_ItemsPresenter2">
|
<Style Selector="^.Columnar /template/ ListBox#PART_ItemsPresenter2">
|
||||||
<Setter Property="ItemContainerTheme" Value="{DynamicResource CarouselIndicatorColumnarListBoxItem}" />
|
<Setter Property="ItemContainerTheme" Value="{DynamicResource CarouselIndicatorColumnarListBoxItem}" />
|
||||||
|
14
src/Semi.Avalonia/Converters/ItemConverter.cs
Normal file
14
src/Semi.Avalonia/Converters/ItemConverter.cs
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
using System.Collections;
|
||||||
|
using System.Linq;
|
||||||
|
using Avalonia.Data.Converters;
|
||||||
|
|
||||||
|
namespace Semi.Avalonia.Converters;
|
||||||
|
|
||||||
|
public static class ItemConverter
|
||||||
|
{
|
||||||
|
public static readonly IValueConverter ItemVisibleConverter =
|
||||||
|
new FuncValueConverter<int?, bool>(count => count is > 1);
|
||||||
|
|
||||||
|
public static readonly IValueConverter ItemToObjectConverter =
|
||||||
|
new FuncValueConverter<int?, IEnumerable>(count => Enumerable.Repeat(new object(), count ?? 0));
|
||||||
|
}
|
@ -1,26 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Globalization;
|
|
||||||
using System.Linq;
|
|
||||||
using Avalonia.Collections;
|
|
||||||
using Avalonia.Controls;
|
|
||||||
using Avalonia.Data.Converters;
|
|
||||||
|
|
||||||
namespace Semi.Avalonia.Converters;
|
|
||||||
|
|
||||||
public class ItemToObjectConverter: IValueConverter
|
|
||||||
{
|
|
||||||
public object Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
|
|
||||||
{
|
|
||||||
if (value is int i)
|
|
||||||
{
|
|
||||||
return Enumerable.Repeat(new object(), i).ToList();
|
|
||||||
}
|
|
||||||
return new List<object>();
|
|
||||||
}
|
|
||||||
|
|
||||||
public object ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
|
|
||||||
{
|
|
||||||
throw new NotImplementedException();
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,9 +1,8 @@
|
|||||||
<ResourceDictionary xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
<ResourceDictionary xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||||
<SolidColorBrush x:Key="CarouselButtonForeground" Opacity="0.5" Color="Black" />
|
<SolidColorBrush x:Key="CarouselButtonForeground" Opacity="0.5" Color="Black" />
|
||||||
<SolidColorBrush x:Key="CarouselButtonPointeroverForeground" Opacity="0.7" Color="Black" />
|
<SolidColorBrush x:Key="CarouselButtonPointeroverForeground" Color="Black" />
|
||||||
<SolidColorBrush x:Key="CarouselButtonPressedForeground" Opacity="0.7" Color="Black" />
|
|
||||||
<SolidColorBrush x:Key="CarouselIndicatorForeground" Opacity="0.5" Color="Black" />
|
<SolidColorBrush x:Key="CarouselIndicatorForeground" Opacity="0.5" Color="Black" />
|
||||||
<SolidColorBrush x:Key="CarouselIndicatorPointeroverForeground" Opacity="0.7" Color="Black" />
|
<SolidColorBrush x:Key="CarouselIndicatorPointeroverForeground" Opacity="0.7" Color="Black" />
|
||||||
<SolidColorBrush x:Key="CarouselIndicatorPressedForeground" Opacity="0.7" Color="Black" />
|
<SolidColorBrush x:Key="CarouselIndicatorPressedForeground" Color="Black" />
|
||||||
<SolidColorBrush x:Key="CarouselIndicatorSelectedForeground" Color="Black" />
|
<SolidColorBrush x:Key="CarouselIndicatorSelectedForeground" Color="Black" />
|
||||||
</ResourceDictionary>
|
</ResourceDictionary>
|
@ -1,9 +1,8 @@
|
|||||||
<ResourceDictionary xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
<ResourceDictionary xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||||
<SolidColorBrush x:Key="CarouselButtonForeground" Opacity="0.5" Color="Black" />
|
<SolidColorBrush x:Key="CarouselButtonForeground" Opacity="0.5" Color="Black" />
|
||||||
<SolidColorBrush x:Key="CarouselButtonPointeroverForeground" Opacity="0.7" Color="Black" />
|
<SolidColorBrush x:Key="CarouselButtonPointeroverForeground" Color="Black" />
|
||||||
<SolidColorBrush x:Key="CarouselButtonPressedForeground" Opacity="0.7" Color="Black" />
|
|
||||||
<SolidColorBrush x:Key="CarouselIndicatorForeground" Opacity="0.5" Color="Black" />
|
<SolidColorBrush x:Key="CarouselIndicatorForeground" Opacity="0.5" Color="Black" />
|
||||||
<SolidColorBrush x:Key="CarouselIndicatorPointeroverForeground" Opacity="0.7" Color="Black" />
|
<SolidColorBrush x:Key="CarouselIndicatorPointeroverForeground" Opacity="0.7" Color="Black" />
|
||||||
<SolidColorBrush x:Key="CarouselIndicatorPressedForeground" Opacity="0.7" Color="Black" />
|
<SolidColorBrush x:Key="CarouselIndicatorPressedForeground" Color="Black" />
|
||||||
<SolidColorBrush x:Key="CarouselIndicatorSelectedForeground" Color="Black" />
|
<SolidColorBrush x:Key="CarouselIndicatorSelectedForeground" Color="Black" />
|
||||||
</ResourceDictionary>
|
</ResourceDictionary>
|
@ -1,15 +1,14 @@
|
|||||||
<ResourceDictionary xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
<ResourceDictionary xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||||
<StreamGeometry x:Key="CarouselButtonGlyph">M16.2782 4.23933C16.864 4.82511 16.864 5.77486 16.2782 6.36065L10.6213 12.0175L16.2782 17.6744C16.864 18.2601 16.864 19.2099 16.2782 19.7957C15.6924 20.3815 14.7426 20.3815 14.1569 19.7957L7.43934 13.0782C6.85355 12.4924 6.85355 11.5426 7.43934 10.9568L14.1569 4.23933C14.7426 3.65354 15.6924 3.65354 16.2782 4.23933Z</StreamGeometry>
|
<StreamGeometry x:Key="CarouselButtonGlyph">M16.2782 4.23933C16.864 4.82511 16.864 5.77486 16.2782 6.36065L10.6213 12.0175L16.2782 17.6744C16.864 18.2601 16.864 19.2099 16.2782 19.7957C15.6924 20.3815 14.7426 20.3815 14.1569 19.7957L7.43934 13.0782C6.85355 12.4924 6.85355 11.5426 7.43934 10.9568L14.1569 4.23933C14.7426 3.65354 15.6924 3.65354 16.2782 4.23933Z</StreamGeometry>
|
||||||
|
|
||||||
<x:Double x:Key="CarouselIndicatorWidth">8</x:Double>
|
<x:Double x:Key="CarouselIndicatorDotWidth">8</x:Double>
|
||||||
<x:Double x:Key="CarouselIndicatorHeight">8</x:Double>
|
<x:Double x:Key="CarouselIndicatorDotHeight">8</x:Double>
|
||||||
|
|
||||||
<x:Double x:Key="CarouselIndicatorLineWidth">78</x:Double>
|
|
||||||
<x:Double x:Key="CarouselIndicatorLineHeight">4</x:Double>
|
<x:Double x:Key="CarouselIndicatorLineHeight">4</x:Double>
|
||||||
|
|
||||||
<x:Double x:Key="CarouselIndicatorColumnarWidth">4</x:Double>
|
<x:Double x:Key="CarouselIndicatorColumnarWidth">4</x:Double>
|
||||||
<x:Double x:Key="CarouselIndicatorColumnarHeight">12</x:Double>
|
<x:Double x:Key="CarouselIndicatorColumnarHeight">12</x:Double>
|
||||||
<x:Double x:Key="CarouselIndicatorColumnarSelectedHeight">20</x:Double>
|
<x:Double x:Key="CarouselIndicatorColumnarSelectedHeight">20</x:Double>
|
||||||
|
|
||||||
<Thickness x:Key="CarouselButtonMargin">8</Thickness>
|
<Thickness x:Key="CarouselButtonMargin">20</Thickness>
|
||||||
</ResourceDictionary>
|
</ResourceDictionary>
|
Loading…
x
Reference in New Issue
Block a user