Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

修复子窗口无法拖动的问题 #11

Merged
merged 1 commit into from
May 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 17 additions & 13 deletions TuneLab/GUI/Dialog.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,25 +21,29 @@
</Window.Styles>

<DockPanel Margin="0">
<Grid DockPanel.Dock="Top" IsHitTestVisible="False" x:Name="TitleBar" Height="40">
<Grid DockPanel.Dock="Top" x:Name="TitleBar" Height="40">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>

<Label x:Name="TitleLabel" Content="Message" FontWeight="Bold" FontSize="14" VerticalAlignment="Center" HorizontalAlignment="Center" Foreground="White" />

<StackPanel Grid.Column="1" VerticalAlignment="Center" HorizontalAlignment="Center" Orientation="Horizontal" IsHitTestVisible="False">
<Label x:Name="TitleLabel" Content="Message" FontWeight="Bold" FontSize="14" VerticalAlignment="Center" HorizontalAlignment="Center" Foreground="White" />
</StackPanel>
</Grid>

<Grid Margin="0">
<Grid.RowDefinitions>
<RowDefinition Height="108" />
<RowDefinition Height="56" />
</Grid.RowDefinitions>
<ContentControl x:Name="Content">
<Grid Margin="0">
<Grid.RowDefinitions>
<RowDefinition Height="108" />
<RowDefinition Height="56" />
</Grid.RowDefinitions>

<StackPanel Grid.Row="0" Orientation="Vertical" Margin="12,0" HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock x:Name="MessageTextBlock" Text="This is a modal window." Foreground="White" TextWrapping="Wrap" TextAlignment="Center" FontSize="14" Padding="0" Margin="0" />
</StackPanel>
<StackPanel Grid.Row="0" Orientation="Vertical" Margin="12,0" HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock x:Name="MessageTextBlock" Text="This is a modal window." Foreground="White" TextWrapping="Wrap" TextAlignment="Center" FontSize="14" Padding="0" Margin="0" />
</StackPanel>

<Grid Grid.Row="1" x:Name="ButtonsPanel" Margin="0, 0, 0, 16"/>
</Grid>
<Grid Grid.Row="1" x:Name="ButtonsPanel" Margin="0, 0, 0, 16"/>
</Grid>
</ContentControl>
</DockPanel>
</Window>
6 changes: 3 additions & 3 deletions TuneLab/GUI/Dialog.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using Avalonia.Media;
using ReactiveUI;
using System;
using System.Reflection.Metadata;
using System.Threading.Tasks;
using TuneLab.GUI;
using TuneLab.GUI.Components;
Expand Down Expand Up @@ -34,13 +35,12 @@ public Dialog()
Topmost = true;

this.DataContext = this;
this.Background = Style.INTERFACE.ToBrush();
this.Background = Style.BACK.ToBrush();
Content.Background = Style.INTERFACE.ToBrush();

titleBar = this.FindControl<Grid>("TitleBar") ?? throw new InvalidOperationException("TitleBar not found");
titleLabel = this.FindControl<Label>("TitleLabel") ?? throw new InvalidOperationException("TitleLabel not found");
messageTextBlock = this.FindControl<TextBlock>("MessageTextBlock") ?? throw new InvalidOperationException("MessageTextBlock not found");

titleBar.Background = Style.BACK.ToBrush();
}

public void SetTitle(string title)
Expand Down
2 changes: 1 addition & 1 deletion TuneLab/Views/LyricInput.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<StackPanel Grid.Column="2" x:Name="WindowControl" HorizontalAlignment="Right" VerticalAlignment="Center" />
</Grid>

<ContentControl>
<ContentControl x:Name="Content">
<Grid Width="480" Height="244">
<Grid.RowDefinitions>
<RowDefinition Height="184" />
Expand Down
5 changes: 3 additions & 2 deletions TuneLab/Views/LyricInput.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ public LyricInput()
WindowStartupLocation = WindowStartupLocation.CenterScreen;
Topmost = true;

this.Background = Style.INTERFACE.ToBrush();
TitleBar.Background = Style.BACK.ToBrush();
this.Background = Style.BACK.ToBrush();
TitleLabel.Foreground = Style.TEXT_LIGHT.ToBrush();

var closeButton = new Button() { Width = 48, Height = 40 }
Expand All @@ -34,6 +33,8 @@ public LyricInput()

WindowControl.Children.Add(closeButton);

Content.Background = Style.INTERFACE.ToBrush();

mLyricInputBox = new TextInput();
mLyricInputBox.AcceptsReturn = true;
mLyricInputBox.Width = 432;
Expand Down
Loading