locked
ContentDialog's buttons are not shown in a Windows Phone 8.1 app if the BottomAppBar is defined

    Question

  • I would like to show a ContentDialog on first launch of my app, to show the EULA to the end user.
    It seems that if an AppBar is defined in the calling page the two buttons in the dialog are not visible, an empty area with the same size of the command bar area defined in the calling page, is shown instead.
    This is the markup on the ContentDialog:
        <ContentDialog
        x:Class="MyApp.EulaPage"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:local="using:MyApp.Pages"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        mc:Ignorable="d"
        Title="TERMS OF USE"
        PrimaryButtonText="i agree"  
        SecondaryButtonText="cancel"
        PrimaryButtonClick="OnAgreeButtonClick"
        SecondaryButtonClick="OnCancelButtonClick">
    
        <Grid x:Name="ContentPanel" Margin="0,0,0,0" >
            <Grid.RowDefinitions>
                <RowDefinition  Height="524" />
            </Grid.RowDefinitions>
            <ScrollViewer Grid.Row="0" Margin="0,0,0,2"  >
                <RichTextBlock IsTextSelectionEnabled="False" TextAlignment="Left" TextIndent="0"  FontSize="14" FontFamily="Segoe WP" >
                </RichTextBlock>
            </ScrollViewer>
        </Grid>
    
    
    </ContentDialog>

    The GridRowDefinition has a fixed hight, because the text in the RichTextBlock needs to be scrolled.

    I have prepared a sample project that can be found here. The zip file contains also a screenshot showing how I see the dialog.

    Antonello


    Sunday, November 16, 2014 11:51 AM

Answers

  • Hi Antonello,

    If I remove the ButtonAppBar, I can see the button of ContentDialog. It should be the problem. When looking into the ContentDialog class, I cannot find any properties to control the position of the PrimaryButton. So I think you need to use other control to work around.

    <Grid>
            <StackPanel>
                <Button Content="show contentdialog" Click="Button_Click"></Button>
            </StackPanel>
            <Popup VerticalOffset="10" x:Name="StandardPopup">
                <StackPanel  VerticalAlignment="Stretch" HorizontalAlignment="Stretch">
                    <TextBox Name="email" Header="Email address"/>
                    <PasswordBox  Name="password" Header="Password"/>
                    <CheckBox Name="showPassword" Content="Show password"/>
                    <!-- Content body -->
                    <TextBlock Name="body" Style="{StaticResource MessageDialogContentStyle}" TextWrapping="Wrap">
                        <TextBlock.Text>
                            Lorem ipsum dolor sit amet, consectetur adipisicing elit,
                        sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
                        </TextBlock.Text>
                    </TextBlock>
                    <StackPanel Orientation="Horizontal">
                        <Button Content="I Agree"></Button>
                        <Button Content="Cancel"></Button>
                    </StackPanel>
                </StackPanel>
            </Popup>
        </Grid>
    

    If you still have questions, please post more information about your scenario.

    Regards,


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place. Click HERE to participate the survey.

    Monday, November 17, 2014 8:21 AM
    Moderator
  • Hi Antonello,

    Thank you for reporting this issue. I am trying to find something about the BottomAppBar control. But now, I would recommend you use the work around to instead.

    Thank you for your understanding.

    Regards,




    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place. Click HERE to participate the survey.

    Tuesday, November 18, 2014 5:39 AM
    Moderator

All replies

  • Hi Antonello,

    If I remove the ButtonAppBar, I can see the button of ContentDialog. It should be the problem. When looking into the ContentDialog class, I cannot find any properties to control the position of the PrimaryButton. So I think you need to use other control to work around.

    <Grid>
            <StackPanel>
                <Button Content="show contentdialog" Click="Button_Click"></Button>
            </StackPanel>
            <Popup VerticalOffset="10" x:Name="StandardPopup">
                <StackPanel  VerticalAlignment="Stretch" HorizontalAlignment="Stretch">
                    <TextBox Name="email" Header="Email address"/>
                    <PasswordBox  Name="password" Header="Password"/>
                    <CheckBox Name="showPassword" Content="Show password"/>
                    <!-- Content body -->
                    <TextBlock Name="body" Style="{StaticResource MessageDialogContentStyle}" TextWrapping="Wrap">
                        <TextBlock.Text>
                            Lorem ipsum dolor sit amet, consectetur adipisicing elit,
                        sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
                        </TextBlock.Text>
                    </TextBlock>
                    <StackPanel Orientation="Horizontal">
                        <Button Content="I Agree"></Button>
                        <Button Content="Cancel"></Button>
                    </StackPanel>
                </StackPanel>
            </Popup>
        </Grid>
    

    If you still have questions, please post more information about your scenario.

    Regards,


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place. Click HERE to participate the survey.

    Monday, November 17, 2014 8:21 AM
    Moderator
  • Hi Herro,

    Thank you, I know, is the BottomAppBar the cause. I'm newbie in WP development and I was surprise to see that a very common scenario, like showing a dialog, has this strange behavior.

    Sincerely, I was thinking, that my code contains a very common mistake that cause the problem.
    Best Regards,

    Antonello.


    Antonello

    Tuesday, November 18, 2014 1:26 AM
  • Hi Antonello,

    Thank you for reporting this issue. I am trying to find something about the BottomAppBar control. But now, I would recommend you use the work around to instead.

    Thank you for your understanding.

    Regards,




    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place. Click HERE to participate the survey.

    Tuesday, November 18, 2014 5:39 AM
    Moderator