Multi-Platform Package Manager for Stable Diffusion
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

112 lines
5.6 KiB

<Styles xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mocks="clr-namespace:StabilityMatrix.Avalonia.DesignData"
xmlns:vmInference="using:StabilityMatrix.Avalonia.ViewModels.Inference"
xmlns:controls="using:StabilityMatrix.Avalonia.Controls"
xmlns:icons="clr-namespace:Projektanker.Icons.Avalonia;assembly=Projektanker.Icons.Avalonia"
xmlns:ui="clr-namespace:FluentAvalonia.UI.Controls;assembly=FluentAvalonia"
xmlns:lang="clr-namespace:StabilityMatrix.Avalonia.Languages"
xmlns:converters="clr-namespace:StabilityMatrix.Avalonia.Converters"
x:DataType="vmInference:BatchSizeCardViewModel">
<Design.PreviewWith>
<StackPanel Spacing="8">
<controls:BatchSizeCard
DataContext="{x:Static mocks:DesignData.BatchSizeCardViewModel}"/>
<controls:BatchSizeCard
Width="280"
DataContext="{x:Static mocks:DesignData.BatchSizeCardViewModelWithIndexOption}"/>
</StackPanel>
</Design.PreviewWith>
<Style Selector="controls|BatchSizeCard">
<Setter Property="Focusable" Value="True"/>
<Setter Property="ContextFlyout">
<ui:FAMenuFlyout Placement="BottomEdgeAlignedLeft">
<ui:ToggleMenuFlyoutItem
IsChecked="{Binding IsBatchIndexEnabled}"
Text="{x:Static lang:Resources.Label_BatchIndex}"/>
</ui:FAMenuFlyout>
</Setter>
<Setter Property="Template">
<ControlTemplate>
<controls:Card Padding="8">
<Grid Margin="8" RowDefinitions="Auto,Auto" ColumnDefinitions="*,*">
<StackPanel>
<StackPanel Orientation="Horizontal" >
<TextBlock
VerticalAlignment="Center"
Margin="0,0,4,0"
Text="Batch Size"/>
<icons:Icon
FontSize="12"
Value="fa-solid fa-table-cells-large"/>
</StackPanel>
<NumericUpDown
HorizontalAlignment="Stretch"
Margin="0,4,4,0"
MinWidth="120"
Minimum="1"
Increment="1"
ParsingNumberStyle="Integer"
Value="{Binding BatchSize, Converter={x:Static converters:NullableDefaultNumericConverters.IntToDecimal}}"
ClipValueToMinMax="True"/>
</StackPanel>
<StackPanel
Grid.Row="0"
Grid.Column="1">
<StackPanel Orientation="Horizontal" >
<TextBlock
VerticalAlignment="Center"
Margin="4,0,8,0"
Text="Batches"/>
<icons:Icon
FontSize="14"
Value="fa-regular fa-images"/>
</StackPanel>
<NumericUpDown
HorizontalAlignment="Stretch"
Margin="4,4,0,0"
MinWidth="120"
Minimum="1"
Increment="1"
ParsingNumberStyle="Integer"
Value="{Binding BatchCount, Converter={x:Static converters:NullableDefaultNumericConverters.IntToDecimal}}"
ClipValueToMinMax="True"/>
</StackPanel>
<!-- Optional index selection -->
<StackPanel
Grid.Row="1"
Grid.Column="0"
Grid.ColumnSpan="2"
IsVisible="{Binding IsBatchIndexEnabled}"
Margin="0,8,0,0">
<StackPanel Orientation="Horizontal" >
<TextBlock
VerticalAlignment="Center"
Margin="0,0,4,0"
Text="{x:Static lang:Resources.Label_BatchIndex}"/>
<icons:Icon
FontSize="12"
Value="fa-solid fa-crosshairs"/>
</StackPanel>
<NumericUpDown
HorizontalAlignment="Stretch"
Margin="0,4,0,0"
MinWidth="120"
Minimum="1"
Maximum="{Binding BatchSize}"
Increment="1"
ParsingNumberStyle="Integer"
Value="{Binding BatchIndex, Converter={x:Static converters:NullableDefaultNumericConverters.IntToDecimal}}"
ClipValueToMinMax="True"/>
</StackPanel>
</Grid>
</controls:Card>
</ControlTemplate>
</Setter>
</Style>
</Styles>