ux: another way to fix transparent background of popup panel on Linux

This commit is contained in:
leo 2024-06-14 09:44:44 +08:00
parent 76bb93518a
commit 1dffb2ebf5
No known key found for this signature in database
GPG key ID: B528468E49CD0E58
4 changed files with 97 additions and 85 deletions

View file

@ -110,13 +110,12 @@
Cursor="BottomRightCorner" Cursor="BottomRightCorner"
Tag="{x:Static WindowEdge.SouthEast}"/> Tag="{x:Static WindowEdge.SouthEast}"/>
<Grid Margin="{TemplateBinding Padding}" Effect="drop-shadow(0 0 12 #A0000000)">
<Border x:Name="PART_ContentRoot" <Border x:Name="PART_ContentRoot"
Background="{DynamicResource Brush.Window}" Background="{DynamicResource Brush.Window}"
BorderBrush="{DynamicResource Brush.Border0}" BorderBrush="{DynamicResource Brush.Border0}"
BorderThickness="1" BorderThickness="1"
Margin="{TemplateBinding Padding}"
CornerRadius="8" CornerRadius="8"
Effect="drop-shadow(0 0 12 #A0000000)"
ClipToBounds="True"> ClipToBounds="True">
<VisualLayerManager> <VisualLayerManager>
<ContentPresenter Name="PART_ContentPresenter" <ContentPresenter Name="PART_ContentPresenter"
@ -127,6 +126,7 @@
</VisualLayerManager> </VisualLayerManager>
</Border> </Border>
</Grid> </Grid>
</Grid>
</ControlTemplate> </ControlTemplate>
</Setter> </Setter>
</Style> </Style>

View file

@ -10,46 +10,71 @@
<StackPanel Orientation="Vertical" Margin="8,0,0,0"> <StackPanel Orientation="Vertical" Margin="8,0,0,0">
<TextBlock Classes="bold" FontSize="18" Text="{DynamicResource Text.Clone}"/> <TextBlock Classes="bold" FontSize="18" Text="{DynamicResource Text.Clone}"/>
<Grid Margin="8,16,0,0" Height="28" ColumnDefinitions="140,*"> <Grid Margin="8,16,0,0" RowDefinitions="32,Auto,32,32,32" ColumnDefinitions="Auto,*">
<TextBlock Grid.Column="0" HorizontalAlignment="Right" Margin="0,0,8,0" Text="{DynamicResource Text.Clone.RemoteURL}"/> <TextBlock Grid.Row="0" Grid.Column="0"
<TextBox Grid.Column="1" CornerRadius="3" Text="{Binding Remote, Mode=TwoWay}" v:AutoFocusBehaviour.IsEnabled="True"/> HorizontalAlignment="Right"
</Grid> Margin="0,0,8,0"
<Grid Margin="8,4,0,0" Height="28" ColumnDefinitions="140,*" IsVisible="{Binding UseSSH}"> Text="{DynamicResource Text.Clone.RemoteURL}"/>
<TextBlock Grid.Column="0" HorizontalAlignment="Right" Margin="0,0,8,0" Text="{DynamicResource Text.SSHKey}"/> <TextBox Grid.Row="0" Grid.Column="1"
<TextBox Grid.Column="1" Height="28"
CornerRadius="3"
Text="{Binding Remote, Mode=TwoWay}"
v:AutoFocusBehaviour.IsEnabled="True"/>
<TextBlock Grid.Row="1" Grid.Column="0"
HorizontalAlignment="Right"
Margin="0,0,8,0"
Text="{DynamicResource Text.SSHKey}"
IsVisible="{Binding UseSSH}"/>
<TextBox Grid.Row="1" Grid.Column="1"
x:Name="TxtSshKey" x:Name="TxtSshKey"
Height="28" Height="28"
CornerRadius="3" CornerRadius="3"
Watermark="{DynamicResource Text.SSHKey.Placeholder}" Watermark="{DynamicResource Text.SSHKey.Placeholder}"
Text="{Binding SSHKey, Mode=TwoWay}"> Text="{Binding SSHKey, Mode=TwoWay}"
IsVisible="{Binding UseSSH}">
<TextBox.InnerRightContent> <TextBox.InnerRightContent>
<Button Classes="icon_button" Width="30" Height="30" Click="SelectSSHKey"> <Button Classes="icon_button" Width="28" Height="28" Click="SelectSSHKey">
<Path Data="{StaticResource Icons.Folder.Open}" Fill="{DynamicResource Brush.FG1}"/> <Path Data="{StaticResource Icons.Folder.Open}" Fill="{DynamicResource Brush.FG1}"/>
</Button> </Button>
</TextBox.InnerRightContent> </TextBox.InnerRightContent>
</TextBox> </TextBox>
</Grid>
<Grid Margin="8,4,0,0" Height="28" ColumnDefinitions="140,*"> <TextBlock Grid.Row="2" Grid.Column="0"
<TextBlock Grid.Column="0" HorizontalAlignment="Right" Margin="0,0,8,0" Text="{DynamicResource Text.Clone.ParentFolder}"/> HorizontalAlignment="Right"
<TextBox Grid.Column="1" Margin="0,0,8,0"
Text="{DynamicResource Text.Clone.ParentFolder}"/>
<TextBox Grid.Row="2" Grid.Column="1"
x:Name="TxtParentFolder" x:Name="TxtParentFolder"
Height="28" Height="28"
CornerRadius="3" CornerRadius="3"
Text="{Binding ParentFolder, Mode=TwoWay}"> Text="{Binding ParentFolder, Mode=TwoWay}">
<TextBox.InnerRightContent> <TextBox.InnerRightContent>
<Button Classes="icon_button" Width="30" Height="30" Margin="4,0,0,0" Click="SelectParentFolder"> <Button Classes="icon_button" Width="28" Height="28" Margin="4,0,0,0" Click="SelectParentFolder">
<Path Data="{StaticResource Icons.Folder.Open}" Fill="{DynamicResource Brush.FG1}"/> <Path Data="{StaticResource Icons.Folder.Open}" Fill="{DynamicResource Brush.FG1}"/>
</Button> </Button>
</TextBox.InnerRightContent> </TextBox.InnerRightContent>
</TextBox> </TextBox>
</Grid>
<Grid Margin="8,4,0,0" Height="28" ColumnDefinitions="140,*"> <TextBlock Grid.Row="3" Grid.Column="0"
<TextBlock Grid.Column="0" HorizontalAlignment="Right" Margin="0,0,8,0" Text="{DynamicResource Text.Clone.LocalName}"/> HorizontalAlignment="Right"
<TextBox Grid.Column="1" CornerRadius="3" Watermark="{DynamicResource Text.Clone.LocalName.Placeholder}" Text="{Binding Local, Mode=TwoWay}"/> Margin="0,0,8,0"
</Grid> Text="{DynamicResource Text.Clone.LocalName}"/>
<Grid Margin="8,4,0,0" Height="28" ColumnDefinitions="140,*"> <TextBox Grid.Row="3" Grid.Column="1"
<TextBlock Grid.Column="0" HorizontalAlignment="Right" Margin="0,0,8,0" Text="{DynamicResource Text.Clone.AdditionalParam}"/> Height="28"
<TextBox Grid.Column="1" CornerRadius="3" Watermark="{DynamicResource Text.Clone.AdditionalParam.Placeholder}" Text="{Binding ExtraArgs, Mode=TwoWay}"/> CornerRadius="3"
Watermark="{DynamicResource Text.Clone.LocalName.Placeholder}"
Text="{Binding Local, Mode=TwoWay}"/>
<TextBlock Grid.Row="4" Grid.Column="0"
HorizontalAlignment="Right"
Margin="0,0,8,0"
Text="{DynamicResource Text.Clone.AdditionalParam}"/>
<TextBox Grid.Row="4" Grid.Column="1"
Height="28"
CornerRadius="3"
Watermark="{DynamicResource Text.Clone.AdditionalParam.Placeholder}"
Text="{Binding ExtraArgs, Mode=TwoWay}"/>
</Grid> </Grid>
</StackPanel> </StackPanel>
</UserControl> </UserControl>

View file

@ -250,33 +250,21 @@
</ContentControl> </ContentControl>
<!-- Popup container --> <!-- Popup container -->
<Grid Grid.Row="1" Margin="0,36,0,0" IsVisible="{Binding ActivePage.Popup, Converter={x:Static ObjectConverters.IsNotNull}}"> <Grid Grid.Row="1" Margin="0,36,0,0" IsVisible="{Binding ActivePage.Popup, Converter={x:Static ObjectConverters.IsNotNull}}" ClipToBounds="True">
<Border Background="Transparent" PointerPressed="OnPopupCancelByClickMask"/> <Border Background="Transparent" PointerPressed="OnPopupCancelByClickMask"/>
<Grid Width="500" HorizontalAlignment="Center" VerticalAlignment="Top"> <Border Width="500" HorizontalAlignment="Center" VerticalAlignment="Top" Effect="drop-shadow(0 0 8 #8F000000)" CornerRadius="0,0,4,4" ClipToBounds="True">
<ContentControl Content="{Binding ActivePage.Popup}" ClipToBounds="True"> <ContentControl Content="{Binding ActivePage.Popup}" Background="{DynamicResource Brush.Popup}">
<ContentControl.DataTemplates> <ContentControl.DataTemplates>
<DataTemplate DataType="vm:Popup"> <DataTemplate DataType="vm:Popup">
<Border Margin="8,0,8,8" <StackPanel Orientation="Vertical" Background="{DynamicResource Brush.Popup}">
Background="{DynamicResource Brush.Popup}"
BorderBrush="{DynamicResource Brush.Border0}"
CornerRadius="0,0,4,4">
<Border.BorderThickness>
<OnPlatform Default="0" Linux="1,0,1,1"/>
</Border.BorderThickness>
<Border.Effect>
<OnPlatform Default="drop-shadow(0 0 8 #8F000000)" Linux="{x:Null}"/>
</Border.Effect>
<StackPanel Margin="8" Orientation="Vertical">
<!-- Popup Widget --> <!-- Popup Widget -->
<ContentPresenter Margin="0,8" <ContentPresenter Margin="8,16,8,8"
Content="{Binding View}" Content="{Binding View}"
IsHitTestVisible="{Binding InProgress, Converter={x:Static BoolConverters.Not}}"/> IsHitTestVisible="{Binding InProgress, Converter={x:Static BoolConverters.Not}}"/>
<!-- Options --> <!-- Options -->
<StackPanel Margin="0,8,0,0" <StackPanel Margin="8,4,8,8"
Height="32" Height="32"
Orientation="Horizontal" Orientation="Horizontal"
HorizontalAlignment="Right" HorizontalAlignment="Right"
@ -294,15 +282,14 @@
</StackPanel> </StackPanel>
<!-- Running --> <!-- Running -->
<v:PopupRunningStatus Margin="8" <v:PopupRunningStatus Margin="12,8"
Description="{Binding ProgressDescription}" Description="{Binding ProgressDescription}"
IsVisible="{Binding InProgress}"/> IsVisible="{Binding InProgress}"/>
</StackPanel> </StackPanel>
</Border>
</DataTemplate> </DataTemplate>
</ContentControl.DataTemplates> </ContentControl.DataTemplates>
</ContentControl> </ContentControl>
</Grid> </Border>
</Grid> </Grid>
<!-- Notification container --> <!-- Notification container -->

View file

@ -8,7 +8,7 @@
x:Class="SourceGit.Views.PopupRunningStatus" x:Class="SourceGit.Views.PopupRunningStatus"
x:Name="me"> x:Name="me">
<StackPanel Orientation="Vertical"> <StackPanel Orientation="Vertical">
<Rectangle Height="1" Margin="-8,0" HorizontalAlignment="Stretch" Fill="{DynamicResource Brush.Border1}" /> <Rectangle Height="1" HorizontalAlignment="Stretch" Fill="{DynamicResource Brush.Border1}" />
<StackPanel Orientation="Horizontal" Margin="0,8"> <StackPanel Orientation="Horizontal" Margin="0,8">
<ContentPresenter x:Name="icon" Width="12" Height="12"/> <ContentPresenter x:Name="icon" Width="12" Height="12"/>