feat: Update demo. improve resizer margin for drawer.

This commit is contained in:
rabbitism
2024-09-17 23:13:56 +08:00
parent 219ead2172
commit dcba26e8af
5 changed files with 23 additions and 0 deletions

View File

@@ -50,6 +50,7 @@
IsChecked="{Binding IsCloseButtonVisible}" IsChecked="{Binding IsCloseButtonVisible}"
IsThreeState="True" /> IsThreeState="True" />
<CheckBox u:FormItem.Label="CanDragMove" IsChecked="{Binding CanDragMove}" /> <CheckBox u:FormItem.Label="CanDragMove" IsChecked="{Binding CanDragMove}" />
<CheckBox u:FormItem.Label="CanResize" IsChecked="{Binding CanResize}" />
<Button <Button
HorizontalAlignment="Left" HorizontalAlignment="Left"
u:FormItem.NoLabel="True" u:FormItem.NoLabel="True"
@@ -85,6 +86,7 @@
IsThreeState="True" /> IsThreeState="True" />
<CheckBox u:FormItem.Label="Modal" IsChecked="{Binding IsModal}" /> <CheckBox u:FormItem.Label="Modal" IsChecked="{Binding IsModal}" />
<CheckBox u:FormItem.Label="CanDragMove" IsChecked="{Binding CanDragMove}" /> <CheckBox u:FormItem.Label="CanDragMove" IsChecked="{Binding CanDragMove}" />
<CheckBox u:FormItem.Label="CanResize" IsChecked="{Binding CanResize}" />
<Button <Button
HorizontalAlignment="Left" HorizontalAlignment="Left"
u:FormItem.NoLabel="True" u:FormItem.NoLabel="True"
@@ -120,6 +122,7 @@
<CheckBox u:FormItem.Label="Can DragMove" IsChecked="{Binding CanDragMove}" /> <CheckBox u:FormItem.Label="Can DragMove" IsChecked="{Binding CanDragMove}" />
<CheckBox u:FormItem.Label="Can LightDismiss" IsChecked="{Binding CanLightDismiss}" /> <CheckBox u:FormItem.Label="Can LightDismiss" IsChecked="{Binding CanLightDismiss}" />
<CheckBox u:FormItem.Label="FullScreen" IsChecked="{Binding FullScreen}" /> <CheckBox u:FormItem.Label="FullScreen" IsChecked="{Binding FullScreen}" />
<CheckBox u:FormItem.Label="CanResize" IsChecked="{Binding CanResize}" />
<ToggleSwitch <ToggleSwitch
u:FormItem.Label="Global/Local OverlayHost" u:FormItem.Label="Global/Local OverlayHost"
IsChecked="{Binding IsLocal}" IsChecked="{Binding IsLocal}"
@@ -150,6 +153,7 @@
<CheckBox u:FormItem.Label="Can DragMove" IsChecked="{Binding CanDragMove}" /> <CheckBox u:FormItem.Label="Can DragMove" IsChecked="{Binding CanDragMove}" />
<CheckBox u:FormItem.Label="Can LightDismiss" IsChecked="{Binding CanLightDismiss}" /> <CheckBox u:FormItem.Label="Can LightDismiss" IsChecked="{Binding CanLightDismiss}" />
<CheckBox u:FormItem.Label="FullScreen" IsChecked="{Binding FullScreen}" /> <CheckBox u:FormItem.Label="FullScreen" IsChecked="{Binding FullScreen}" />
<CheckBox u:FormItem.Label="CanResize" IsChecked="{Binding CanResize}" />
<ToggleSwitch <ToggleSwitch
u:FormItem.Label="Global/Local OverlayHost" u:FormItem.Label="Global/Local OverlayHost"
IsChecked="{Binding IsLocal}" IsChecked="{Binding IsLocal}"

View File

@@ -27,6 +27,7 @@
<CheckBox u:FormItem.Label="Is Modal" IsChecked="{Binding IsModal}"/> <CheckBox u:FormItem.Label="Is Modal" IsChecked="{Binding IsModal}"/>
<CheckBox u:FormItem.Label="Is Close Button Visible" IsChecked="{Binding IsCloseButtonVisible}" IsThreeState="True"/> <CheckBox u:FormItem.Label="Is Close Button Visible" IsChecked="{Binding IsCloseButtonVisible}" IsThreeState="True"/>
<CheckBox u:FormItem.Label="Custom Dialog" IsChecked="{Binding Custom}"/> <CheckBox u:FormItem.Label="Custom Dialog" IsChecked="{Binding Custom}"/>
<CheckBox u:FormItem.Label="CanResize" IsChecked="{Binding CanResize}" />
<ToggleSwitch <ToggleSwitch
u:FormItem.Label="Global/Local OverlayHost" u:FormItem.Label="Global/Local OverlayHost"
IsChecked="{Binding IsLocal}" IsChecked="{Binding IsLocal}"

View File

@@ -32,6 +32,7 @@ public partial class DefaultWindowDialogDemoViewModel: ObservableObject
[ObservableProperty] private bool _showInTaskBar; [ObservableProperty] private bool _showInTaskBar;
[ObservableProperty] private bool? _isCloseButtonVisible; [ObservableProperty] private bool? _isCloseButtonVisible;
[ObservableProperty] private bool _canDragMove; [ObservableProperty] private bool _canDragMove;
[ObservableProperty] private bool _canResize;
public ICommand ShowDialogCommand { get; } public ICommand ShowDialogCommand { get; }
@@ -55,6 +56,7 @@ public partial class DefaultWindowDialogDemoViewModel: ObservableObject
IsCloseButtonVisible = IsCloseButtonVisible, IsCloseButtonVisible = IsCloseButtonVisible,
StartupLocation = Location, StartupLocation = Location,
CanDragMove = CanDragMove, CanDragMove = CanDragMove,
CanResize = CanResize,
}; };
if (X.HasValue && Y.HasValue) if (X.HasValue && Y.HasValue)
{ {
@@ -74,6 +76,7 @@ public partial class CustomWindowDialogDemoViewModel: ObservableObject
[ObservableProperty] private bool? _isCloseButtonVisible; [ObservableProperty] private bool? _isCloseButtonVisible;
[ObservableProperty] private bool _isModal; [ObservableProperty] private bool _isModal;
[ObservableProperty] private bool _canDragMove; [ObservableProperty] private bool _canDragMove;
[ObservableProperty] private bool _canResize;
public ICommand ShowDialogCommand { get; } public ICommand ShowDialogCommand { get; }
@@ -94,6 +97,7 @@ public partial class CustomWindowDialogDemoViewModel: ObservableObject
IsCloseButtonVisible = IsCloseButtonVisible, IsCloseButtonVisible = IsCloseButtonVisible,
StartupLocation = Location, StartupLocation = Location,
CanDragMove = CanDragMove, CanDragMove = CanDragMove,
CanResize = CanResize,
}; };
if (X.HasValue && Y.HasValue) if (X.HasValue && Y.HasValue)
{ {
@@ -128,6 +132,7 @@ public partial class DefaultOverlayDialogDemoViewModel : ObservableObject
[ObservableProperty] private bool? _isCloseButtonVisible; [ObservableProperty] private bool? _isCloseButtonVisible;
[ObservableProperty] private bool _isModal; [ObservableProperty] private bool _isModal;
[ObservableProperty] private bool _isLocal; [ObservableProperty] private bool _isLocal;
[ObservableProperty] private bool _canResize;
public ICommand ShowDialogCommand { get; } public ICommand ShowDialogCommand { get; }
@@ -157,6 +162,7 @@ public partial class DefaultOverlayDialogDemoViewModel : ObservableObject
CanLightDismiss = CanLightDismiss, CanLightDismiss = CanLightDismiss,
CanDragMove = CanDragMove, CanDragMove = CanDragMove,
IsCloseButtonVisible = IsCloseButtonVisible, IsCloseButtonVisible = IsCloseButtonVisible,
CanResize = CanResize,
}; };
string? dialogHostId = IsLocal ? DialogDemoViewModel.LocalHost : null; string? dialogHostId = IsLocal ? DialogDemoViewModel.LocalHost : null;
if (IsModal) if (IsModal)
@@ -183,6 +189,7 @@ public partial class CustomOverlayDialogDemoViewModel: ObservableObject
[ObservableProperty] private bool? _isCloseButtonVisible; [ObservableProperty] private bool? _isCloseButtonVisible;
[ObservableProperty] private bool _isModal; [ObservableProperty] private bool _isModal;
[ObservableProperty] private bool _isLocal; [ObservableProperty] private bool _isLocal;
[ObservableProperty] private bool _canResize;
public ICommand ShowDialogCommand { get; } public ICommand ShowDialogCommand { get; }
@@ -208,6 +215,7 @@ public partial class CustomOverlayDialogDemoViewModel: ObservableObject
CanLightDismiss = CanLightDismiss, CanLightDismiss = CanLightDismiss,
CanDragMove = CanDragMove, CanDragMove = CanDragMove,
IsCloseButtonVisible = IsCloseButtonVisible, IsCloseButtonVisible = IsCloseButtonVisible,
CanResize = CanResize,
}; };
var dialogHostId = IsLocal ? DialogDemoViewModel.LocalHost : null; var dialogHostId = IsLocal ? DialogDemoViewModel.LocalHost : null;
if (IsModal) if (IsModal)

View File

@@ -24,6 +24,7 @@ public partial class DrawerDemoViewModel : ObservableObject
[ObservableProperty] private bool _custom; [ObservableProperty] private bool _custom;
[ObservableProperty] private bool _isLocal; [ObservableProperty] private bool _isLocal;
[ObservableProperty] private bool _canResize;
public DrawerDemoViewModel() public DrawerDemoViewModel()
{ {
@@ -42,6 +43,7 @@ public partial class DrawerDemoViewModel : ObservableObject
CanLightDismiss = CanLightDismiss, CanLightDismiss = CanLightDismiss,
IsCloseButtonVisible = IsCloseButtonVisible, IsCloseButtonVisible = IsCloseButtonVisible,
Title = Title, Title = Title,
CanResize = CanResize,
}; };
var hostId = IsLocal ? "LocalHost" : null; var hostId = IsLocal ? "LocalHost" : null;
if (Custom) if (Custom)

View File

@@ -78,15 +78,19 @@
<Setter Property="BorderThickness" Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=BorderThickness, Converter={x:Static c:ThicknessTakeConverter.Top}}" /> <Setter Property="BorderThickness" Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=BorderThickness, Converter={x:Static c:ThicknessTakeConverter.Top}}" />
</Style> </Style>
<Style Selector="^[Position=Top] /template/ u|DialogResizer"> <Style Selector="^[Position=Top] /template/ u|DialogResizer">
<Setter Property="Margin" Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Padding, Converter={x:Static c:ThicknessTakeConverter.Bottom}}" />
<Setter Property="ResizeDirection" Value="Bottom"/> <Setter Property="ResizeDirection" Value="Bottom"/>
</Style> </Style>
<Style Selector="^[Position=Bottom] /template/ u|DialogResizer"> <Style Selector="^[Position=Bottom] /template/ u|DialogResizer">
<Setter Property="Margin" Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Padding, Converter={x:Static c:ThicknessTakeConverter.Top}}" />
<Setter Property="ResizeDirection" Value="Top"/> <Setter Property="ResizeDirection" Value="Top"/>
</Style> </Style>
<Style Selector="^[Position=Left] /template/ u|DialogResizer"> <Style Selector="^[Position=Left] /template/ u|DialogResizer">
<Setter Property="Margin" Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Padding, Converter={x:Static c:ThicknessTakeConverter.Right}}" />
<Setter Property="ResizeDirection" Value="Right"/> <Setter Property="ResizeDirection" Value="Right"/>
</Style> </Style>
<Style Selector="^[Position=Right] /template/ u|DialogResizer"> <Style Selector="^[Position=Right] /template/ u|DialogResizer">
<Setter Property="Margin" Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Padding, Converter={x:Static c:ThicknessTakeConverter.Left}}" />
<Setter Property="ResizeDirection" Value="Left"/> <Setter Property="ResizeDirection" Value="Left"/>
</Style> </Style>
</ControlTheme> </ControlTheme>
@@ -203,15 +207,19 @@
<Setter Property="BorderThickness" Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=BorderThickness, Converter={x:Static c:ThicknessTakeConverter.Top}}" /> <Setter Property="BorderThickness" Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=BorderThickness, Converter={x:Static c:ThicknessTakeConverter.Top}}" />
</Style> </Style>
<Style Selector="^[Position=Top] /template/ u|DialogResizer"> <Style Selector="^[Position=Top] /template/ u|DialogResizer">
<Setter Property="Margin" Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Padding, Converter={x:Static c:ThicknessTakeConverter.Bottom}}" />
<Setter Property="ResizeDirection" Value="Bottom"/> <Setter Property="ResizeDirection" Value="Bottom"/>
</Style> </Style>
<Style Selector="^[Position=Bottom] /template/ u|DialogResizer"> <Style Selector="^[Position=Bottom] /template/ u|DialogResizer">
<Setter Property="Margin" Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Padding, Converter={x:Static c:ThicknessTakeConverter.Top}}" />
<Setter Property="ResizeDirection" Value="Top"/> <Setter Property="ResizeDirection" Value="Top"/>
</Style> </Style>
<Style Selector="^[Position=Left] /template/ u|DialogResizer"> <Style Selector="^[Position=Left] /template/ u|DialogResizer">
<Setter Property="Margin" Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Padding, Converter={x:Static c:ThicknessTakeConverter.Right}}" />
<Setter Property="ResizeDirection" Value="Right"/> <Setter Property="ResizeDirection" Value="Right"/>
</Style> </Style>
<Style Selector="^[Position=Right] /template/ u|DialogResizer"> <Style Selector="^[Position=Right] /template/ u|DialogResizer">
<Setter Property="Margin" Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Padding, Converter={x:Static c:ThicknessTakeConverter.Left}}" />
<Setter Property="ResizeDirection" Value="Left"/> <Setter Property="ResizeDirection" Value="Left"/>
</Style> </Style>
</ControlTheme> </ControlTheme>