locked
[UWP][Xaml]UWP: Size and Text Wrap issue of Content Dialog RRS feed

  • Question

  • Hi,

    VS2017 | UWP 

    I wanted to display icons in MessageDialog(), but it seems the option is not available.  So i looked at ContentDialog.  But The problem with ContentDialog is that its size is too small and does not auto-resize based on contents.  Also it does not Wrap Contents.   Its proving very difficult to do simple thing.  I am sure others too must be facing similar issue, What solution do you suggest ?

    below is my XAML code and output image.

     Title="TITLE"
        PrimaryButtonText="OK" FullSizeDesired="False"
        PrimaryButtonClick="ContentDialog_PrimaryButtonClick"
    >
        <Grid  Height="Auto" >
            <StackPanel Orientation="Horizontal"  Height="Auto" >
                <TextBlock x:Name="Image"  FontFamily="Wingdings" FontSize="40" Foreground="Green" Text="&#x4A;" Margin="5"/>
                <StackPanel Orientation="Vertical"  Height="Auto" >
                    <TextBlock x:Name="MessageText1" Text="." TextWrapping="WrapWholeWords"  Margin="5,0,0,0" HorizontalAlignment="Left" Height="Auto" />
                    <TextBlock x:Name="MessageText2" Text="." TextWrapping="WrapWholeWords"  Margin="5,0,0,0" HorizontalAlignment="Left" Height="Auto"  />
                </StackPanel>
            </StackPanel>
        </Grid>

    Please Note:  TextWrapping="Wrap" is also tried, but output remains the same. it does not wrap contents. The file path is not fully displayed.


    Friday, June 29, 2018 10:40 AM

All replies

  • Hi,

    Yep, in my test, the TextBlock does not warp the text in the ContentDialog using your code snippet. After checking the Live Visual Tree, I found the key is that you need to define the width of the TextBlock. If not, the TextBlock will get a width suitable for the length of the text automatically. 

    So I suggest that you might need to set the width of the TextBlock like 200 and run the app you could see the text is wrapped.

    For the size of the Icon, it is not a image control and it is determined by the font size. You need to define the font size to change the size of the icon. 

    Best regards,

    Roy


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, July 2, 2018 2:27 AM
  • Hi,

    Any updates for the problem?

    Does my reply make sense?

    Best regards,

    Roy


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Wednesday, July 4, 2018 9:16 AM