unoplatform / uno

Open-source platform for building cross-platform native Mobile, Web, Desktop and Embedded apps quickly. Create rich, C#/XAML, single-codebase apps from any IDE. Hot Reload included! 90m+ NuGet Downloads!!
https://platform.uno
Apache License 2.0
9.1k stars 740 forks source link

Cannot customize the style of a `ContentDialog` #5975

Open takla21 opened 3 years ago

takla21 commented 3 years ago

Current behavior

Android android_popup

iOS ios_popup

Expected behavior

Even if I couldn't customize the style of the content dialog on UWP as well, at least UWP gives us static resources that can be overridden https://docs.microsoft.com/en-us/uwp/api/windows.ui.xaml.controls.contentdialog?view=winrt-19041#control-style-and-template

Example from sample (see below)

<SolidColorBrush x:Key="TestBackground"
                Color="Red" />
<SolidColorBrush x:Key="TestForeground"
                Color="DarkBlue" />
<SolidColorBrush x:Key="TestBorderBrush"
                Color="DarkGreen" />

<!-- Resources for Windows.UI.Xaml.Controls.ContentDialog -->
<StaticResource x:Key="ContentDialogForeground"
            ResourceKey="TestForeground" />
<StaticResource x:Key="ContentDialogBackground"
            ResourceKey="TestBackground" />
<StaticResource x:Key="ContentDialogBorderBrush"
            ResourceKey="TestBorderBrush" />

<Thickness x:Key="ContentDialogCommandSpaceMargin">0,24,0,0</Thickness>
<Thickness x:Key="ContentDialogPadding">0</Thickness>

uwp_popup

How to reproduce it (as minimally and precisely as possible)

Download this sample ContentDialogSample.zip Deploy on either (UWP, Android or iOS) Click on the button

Workaround

N/A

Environment

Nuget Package:

Nuget Package Version(s): 3.8.0-dev.130

Affected platform(s):

IDE:

Relevant plugins:

Anything else we need to know?

jeromelaban commented 3 years ago

@davidjohnoliver could it be caused by an invalid style (or the properties named differently) on our end ?

davidjohnoliver commented 3 years ago

It seems that we're consuming those resources in the default style:

https://github.com/unoplatform/uno/blob/e8cb04cd3d30983eeb7bc7583f7216ae537593e8/src/Uno.UI/UI/Xaml/Controls/ContentDialog/ContentDialog.xaml#L25-L27

MartinZikmund commented 6 months ago

This might be fixed, can you please verify?