mirror of
https://github.com/AtomUI/AtomUI.git
synced 2026-10-28 06:07:28 +08:00
Fix Window Content CornerRadius bug
This commit is contained in:
+2
-2
@@ -2,7 +2,7 @@
|
||||
<PropertyGroup>
|
||||
<NoWarn>$(NoWarn);CS7035</NoWarn>
|
||||
<AvaloniaVersion>11.3.9</AvaloniaVersion>
|
||||
<AtomUIVersion>5.1.3-build.2</AtomUIVersion>
|
||||
<AtomUIGalleryVersion>5.1.3-build.2</AtomUIGalleryVersion>
|
||||
<AtomUIVersion>5.1.3-build.3</AtomUIVersion>
|
||||
<AtomUIGalleryVersion>5.1.3-build.3</AtomUIGalleryVersion>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
@@ -542,12 +542,11 @@ internal class ImagePreviewerDialog : Window,
|
||||
const double ratio = 0.70d;
|
||||
var height = ClientAreaScreenGeometry.Height * ratio;
|
||||
var width = ClientAreaScreenGeometry.Width * ratio;
|
||||
Width = width;
|
||||
Height = height;
|
||||
ClientSize = new Size(width, height);
|
||||
_firstSizeCalculated = true;
|
||||
return new Size(width, height);
|
||||
}
|
||||
return new Size(Width, Height);
|
||||
return ClientSize;
|
||||
}
|
||||
|
||||
private void HandleHorizontalFlipRequest()
|
||||
|
||||
@@ -2,7 +2,10 @@
|
||||
xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:atom="https://atomui.net"
|
||||
xmlns:converters="clr-namespace:Avalonia.Controls.Converters;assembly=Avalonia.Controls"
|
||||
x:ClassModifier="internal">
|
||||
<converters:CornerRadiusFilterConverter x:Key="CornerRadiusFilterConverter"
|
||||
Filter="BottomLeft, BottomRight"/>
|
||||
<ControlTheme x:Key="{x:Type atom:ImagePreviewerDialog}" TargetType="atom:ImagePreviewerDialog">
|
||||
<ControlTheme.BasedOn>
|
||||
<atom:WindowTheme TargetType="atom:ImagePreviewerDialog" />
|
||||
@@ -42,7 +45,7 @@
|
||||
</Border>
|
||||
|
||||
<Border Name="ContentFrame"
|
||||
CornerRadius="{TemplateBinding CornerRadius}"
|
||||
CornerRadius="{TemplateBinding CornerRadius, Converter={StaticResource CornerRadiusFilterConverter}}"
|
||||
ClipToBounds="True"
|
||||
Cursor="Arrow"
|
||||
Background="{TemplateBinding ContentBackground}"
|
||||
|
||||
@@ -97,9 +97,8 @@ public class CardTabControl : BaseTabControl
|
||||
tabItem.Shape = TabSharp.Card;
|
||||
Debug.Assert(ItemsBindingDisposables.ContainsKey(tabItem));
|
||||
var disposables = ItemsBindingDisposables[tabItem];
|
||||
disposables.Add(BindUtils.RelayBind(this, EffectiveCardBorderRadiusProperty, tabItem, TabItem.CornerRadiusProperty));
|
||||
// Use template-level priority so selected-state styles can override border thickness
|
||||
disposables.Add(BindUtils.RelayBind(this, CardBorderThicknessProperty, tabItem, TabItem.BorderThicknessProperty, BindingMode.Default, BindingPriority.Template));
|
||||
disposables.Add(BindUtils.RelayBind(this, EffectiveCardBorderRadiusProperty, tabItem, CornerRadiusProperty));
|
||||
disposables.Add(BindUtils.RelayBind(this, CardBorderThicknessProperty, tabItem, BorderThicknessProperty));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -10,51 +10,39 @@
|
||||
</ControlTheme.BasedOn>
|
||||
<Setter Property="Template">
|
||||
<ControlTemplate>
|
||||
<Border Name="Frame"
|
||||
BorderThickness="{TemplateBinding BorderThickness}"
|
||||
CornerRadius="{TemplateBinding CornerRadius}"
|
||||
Margin="{TemplateBinding Margin}"
|
||||
Background="{TemplateBinding Background}"
|
||||
BorderBrush="{TemplateBinding BorderBrush}"
|
||||
Padding="{TemplateBinding Padding}">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<atom:IconPresenter Name="ItemIconPresenter"
|
||||
Icon="{TemplateBinding Icon}"
|
||||
IsVisible="{TemplateBinding Icon, Converter={x:Static ObjectConverters.IsNotNull}}" />
|
||||
<ContentPresenter Name="ContentPresenter"
|
||||
Content="{TemplateBinding Header}"
|
||||
ContentTemplate="{TemplateBinding HeaderTemplate, Converter={x:Static atom:BaseTabItemTheme.StringToTextBlockConverter}}" />
|
||||
<atom:IconButton Name="{x:Static atom:TabItemThemeConstants.ItemCloseButtonPart}"
|
||||
Icon="{TemplateBinding CloseIcon}"
|
||||
Opacity="{TemplateBinding CloseButtonOpacity}"
|
||||
VerticalAlignment="Center" />
|
||||
</StackPanel>
|
||||
</Border>
|
||||
<Panel>
|
||||
<Border Name="Frame"
|
||||
BorderThickness="{TemplateBinding BorderThickness}"
|
||||
CornerRadius="{TemplateBinding CornerRadius}"
|
||||
Margin="{TemplateBinding Margin}"
|
||||
Background="{TemplateBinding Background}"
|
||||
BorderBrush="{TemplateBinding BorderBrush}"
|
||||
Padding="{TemplateBinding Padding}">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<atom:IconPresenter Name="ItemIconPresenter"
|
||||
Icon="{TemplateBinding Icon}"
|
||||
IsVisible="{TemplateBinding Icon, Converter={x:Static ObjectConverters.IsNotNull}}" />
|
||||
<ContentPresenter Name="ContentPresenter"
|
||||
Content="{TemplateBinding Header}"
|
||||
ContentTemplate="{TemplateBinding HeaderTemplate, Converter={x:Static atom:BaseTabItemTheme.StringToTextBlockConverter}}" />
|
||||
<atom:IconButton Name="{x:Static atom:TabItemThemeConstants.ItemCloseButtonPart}"
|
||||
Icon="{TemplateBinding CloseIcon}"
|
||||
Opacity="{TemplateBinding CloseButtonOpacity}"
|
||||
VerticalAlignment="Center" />
|
||||
</StackPanel>
|
||||
</Border>
|
||||
<Rectangle Height="1" Fill="Red" VerticalAlignment="Bottom" Margin="1, 0, 1, 0"/>
|
||||
</Panel>
|
||||
</ControlTemplate>
|
||||
</Setter>
|
||||
|
||||
<Setter Property="Margin" Value="{DynamicResource {x:Static atom:TabControlTokenKey.HorizontalItemMargin}}" />
|
||||
<Setter Property="Background" Value="{DynamicResource {x:Static atom:TabControlTokenKey.CardBg}}" />
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource {x:Static atom:SharedTokenKey.ColorBorderSecondary}}" />
|
||||
<Setter Property="BorderThickness" Value="{DynamicResource {x:Static atom:SharedTokenKey.BorderThickness}}" />
|
||||
|
||||
<Style Selector="^:selected">
|
||||
<Setter Property="Background" Value="{DynamicResource {x:Static atom:SharedTokenKey.ColorBgContainer}}" />
|
||||
</Style>
|
||||
<!-- 选中态按放置方向去掉靠内容侧的边框 -->
|
||||
<Style Selector="^[TabStripPlacement=Top]:selected">
|
||||
<Setter Property="BorderThickness" Value="1,1,1,0" />
|
||||
</Style>
|
||||
<Style Selector="^[TabStripPlacement=Bottom]:selected">
|
||||
<Setter Property="BorderThickness" Value="1,0,1,1" />
|
||||
</Style>
|
||||
<Style Selector="^[TabStripPlacement=Left]:selected">
|
||||
<Setter Property="BorderThickness" Value="1,1,0,1" />
|
||||
</Style>
|
||||
<Style Selector="^[TabStripPlacement=Right]:selected">
|
||||
<Setter Property="BorderThickness" Value="0,1,1,1" />
|
||||
</Style>
|
||||
|
||||
|
||||
<Style Selector="^[TabStripPlacement=Top], ^[TabStripPlacement=Bottom]">
|
||||
<Setter Property="Margin" Value="{DynamicResource {x:Static atom:TabControlTokenKey.HorizontalItemMargin}}" />
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
|
||||
<Border Name="ContentFrame"
|
||||
Background="{TemplateBinding ContentBackground}"
|
||||
CornerRadius="{TemplateBinding CornerRadius}"
|
||||
CornerRadius="{TemplateBinding CornerRadius, Converter={x:Static atom:WindowTheme.CornerRadiusConverter}}"
|
||||
ClipToBounds="True"
|
||||
Cursor="Arrow"
|
||||
Container.Name="{x:Static atom:IMediaBreakAwareControl.GlobalQueryContainerName}"
|
||||
|
||||
@@ -1,7 +1,12 @@
|
||||
using Avalonia.Controls.Converters;
|
||||
using Avalonia.Styling;
|
||||
|
||||
namespace AtomUI.Desktop.Controls.Themes;
|
||||
|
||||
internal class WindowTheme : ControlTheme
|
||||
{
|
||||
public static readonly CornerRadiusFilterConverter CornerRadiusConverter = new CornerRadiusFilterConverter()
|
||||
{
|
||||
Filter = Corners.BottomLeft | Corners.BottomRight,
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user