Content dialog size is getting changed with window scalling

Sunil A M 171 Reputation points
2022-12-27T12:11:17.353+00:00

Hi Team,

Its a winui3 application - Content dialog size is getting changed with window scaling.

Error scenario.
1.Window scalling
274218-image.png

2.height and width of Content dialog on top of the window(mainGrid).
274325-image.png

3.Text is cutting content dialog.
274238-image.png

Working Senario
1.window scalling.
274268-image.png

2.height and width of Content dialog on top of the window(mainGrid).
274219-image.png

3.Text is coming properly in this senario.
274249-image.png

Could you plz provide a solution make the text properly fit into the custom dialog.

Best Regards,
Sunil

Windows development | Windows App SDK
Developer technologies | C#
Developer technologies | C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Anonymous
    2022-12-28T05:29:48+00:00

    Hello,

    Welcome to Microsoft Q&A!

    This is the expected behavior when you change the scale value form Settings. The text in your app will also be scaled. A simple way is to change the default max width of the ContentDialog control. The default Max Width of ContentDialog is 548. You could override the theme resource which named ContentDialogMaxWidth to a bigger value. So the ContentDialog will become bigger and it could show all the text.

    For example, like this:

     <Application.Resources>  
            <ResourceDictionary>  
                <ResourceDictionary.MergedDictionaries>  
                    <XamlControlsResources xmlns="using:Microsoft.UI.Xaml.Controls" />  
                    <!-- Other merged dictionaries here -->  
                </ResourceDictionary.MergedDictionaries>  
                <x:Double x:Key="ContentDialogMaxWidth">2000</x:Double>  
                <!-- Other app resources here -->  
            </ResourceDictionary>  
        </Application.Resources>  
    

    Thank you.


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.