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

[Enhancement] Add dialog style Settings #84

Open
XueDee123 opened this issue Jul 5, 2023 · 3 comments
Open

[Enhancement] Add dialog style Settings #84

XueDee123 opened this issue Jul 5, 2023 · 3 comments
Labels
enhancement New feature or request help wanted Extra attention is needed
Milestone

Comments

@XueDee123
Copy link

XueDee123 commented Jul 5, 2023

Description

Dialog style Settings are currently invalid, whether to add this feature, in the wpf version of prism is supported to set dialog style, this feature is still important

Context

<prism:Dialog.WindowStyle>
    <style selector="Window">
        <Setter Property="Background" Value="Red"/>
    </style>
</prism:Dialog.WindowStyle>
@XueDee123 XueDee123 added the enhancement New feature or request label Jul 5, 2023
@XueDee123 XueDee123 changed the title [增强] Add dialog style Settings Jul 5, 2023
@DamianSuess DamianSuess added this to the Avalonia v11.0 milestone Jul 5, 2023
@t115liyanpeng
Copy link

t115liyanpeng commented Aug 17, 2023

需要使用 DialogWindow 来去修改 对话框窗口的样式

需要新建一个 window 实现IDialogWindow接口,像这样

    public partial class TestDialogWindow : Window, IDialogWindow
    {
        public TestDialogWindow()
        {
            InitializeComponent();
        }

        public IDialogResult? Result { get; set; }

        object? IDialogWindow.Content { get => null; set { if (value != null) Dock.Children[1] = (Control)value; } }
    }

xaml

	<Window.Styles>
		<Style Selector="Window">
			<Setter Property="SizeToContent" Value="WidthAndHeight" />
		</Style>
	</Window.Styles>
	<Border Padding="2 2 2 2">
		<DockPanel MinWidth="200" x:Name="Dock" LastChildFill="True">
			<Border DockPanel.Dock="Top" Height="40">
				<Label Content="{Binding Title}" VerticalAlignment="Center" HorizontalContentAlignment="Left" />
			</Border>
			<Border />
		</DockPanel>
	</Border>

然后注册DialogWindow 和 Dialog

containerRegistry.RegisterDialog<LoadingBox, LoadingBoxViewModel>(nameof(LoadingBox));
containerRegistry.RegisterDialogWindow<TestDialogWindow>("test");

使用的时候 需要这样使用
_dialogService.ShowDialog(nameof(LoadingBox), param, r =>{},"test");
这样dialog的窗口样式就改变成你修改的样式了

@XueDee123
Copy link
Author

需要使用 DialogWindow 来去修改 对话框窗口的样式

需要新建一个 window 实现IDialogWindow接口,像这样 `public partial class TestDialogWindow : Window, IDialogWindow { public TestDialogWindow() { InitializeComponent(); }

    public IDialogResult? Result { get; set; }

    object? IDialogWindow.Content { get => null; set { if (value != null) Dock.Children[1] = (Control)value; } }
}`

xaml: <Window.Styles> <Style Selector="Window"> <Setter Property="SizeToContent" Value="WidthAndHeight" /> </Style> </Window.Styles> <Border Padding="2 2 2 2"> <DockPanel MinWidth="200" x:Name="Dock" LastChildFill="True"> <Border DockPanel.Dock="Top" Height="40"> <Label Content="{Binding Title}" VerticalAlignment="Center" HorizontalContentAlignment="Left" /> </Border> <Border /> </DockPanel> </Border>

然后注册DialogWindow 和 Dialog

containerRegistry.RegisterDialog<LoadingBox, LoadingBoxViewModel>(nameof(LoadingBox)); containerRegistry.RegisterDialogWindow<TestDialogWindow>("test"); 使用的时候 需要这样使用 _dialogService.ShowDialog(nameof(LoadingBox), param, r =>{},"test"); 这样dialog的窗口样式就改变成你修改的样式了

What you described above is a custom pop-up style, which is no problem. Imagine if you customize a pop-up style, but some internal parameters need to be assigned according to actual use, for example, I need to give a title tag to the pop-up frame, or I need to change the color of a certain style, and so on. How should these be implemented? In the wpf version of prism, it is possible to modify it according to the style, but the avalonia version of prism does not support it. Although I have implemented it through other ways, it is very troublesome

@t115liyanpeng
Copy link

是的,它还不够完美,我也试图只通过样式来修改,但是它不起作用,确实这种方法比较麻烦

@DamianSuess DamianSuess modified the milestones: Avalonia v11.0, vNext Aug 18, 2023
@DamianSuess DamianSuess added the help wanted Extra attention is needed label Apr 8, 2024
@DamianSuess DamianSuess changed the title Add dialog style Settings [Enhancement] Add dialog style Settings Aug 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants