iloveiniestaandowen
iloveiniestaandowen

Reputation: 141

In windows phone,Messagebox caption only can show less than two lines?

    public static MessageBoxResult Show(
    string messageBoxText,
    string caption,
    MessageBoxButton button
)

use below code to show a messagebox
The problem is
If the caption is too long,the messagebox will not display well
Like thisenter image description here

I have tried to use some symbol like “\n”,but it doesn't work,can't change to 3 lines
Is there a 2 lines limit in windows phone messagebox caption?
And would u help me to solve this problem?
Thanks ,Any advice will be great!!

Upvotes: 0

Views: 188

Answers (3)

Pradeep Kesharwani
Pradeep Kesharwani

Reputation: 1478

 You could implement customize messageBox like this.
Put this code in .xaml and make changes accordingly
   <Border Grid.Row="0" Grid.RowSpan="2" Visibility="Collapsed" Name="stkMessage">
                <Border.Background >
                    <ImageBrush ImageSource="../Images/LoderBackground.png" />
                </Border.Background>
                <StackPanel  Height="200" Width="480" VerticalAlignment="Top" Background="#B0C4DE">               
                    <StackPanel Height="130" Width="460">
                        <TextBlock Name="txtMessage" Text="abc..." Foreground="#1c1c1c" TextWrapping="Wrap" FontSize="24" FontWeight="SemiBold" FontFamily="/Font/BKANT.TTF#Book Antiqua" Margin="20,40,20,20"></TextBlock>
                    </StackPanel>
                    <StackPanel Height="70">
                        <Button x:Name="btnOk" Background="#123C8E" Height="70" Padding="0" Content="OK" Width="150" Style="{StaticResource ButtonStyle1}" Click="btnOk_Click_1" BorderThickness="1" BorderBrush="#123C8E" FontFamily="/Font/BKANT.TTF#Book Antiqua" >

                        </Button>
                    </StackPanel>
                </StackPanel>
            </Border>

Put this code in .cs

 private void btnOk_Click_1(object sender, RoutedEventArgs e)
        {
            txtMessage.Text = "";
            stkMessage.Visibility = Visibility.Collapsed;
        }

Upvotes: 0

Developer
Developer

Reputation: 4321

I agree with Aju, or you could also create your own custom control, exactly like message box, if you don't wan't to install 3-rd party libraries

Upvotes: 0

Aju
Aju

Reputation: 806

I would say that MessageBox.Show() is not really that Developer Friendly. You can use CustomMessageBox, which is in the Toolkit currently. You could find further details here

Upvotes: 3

Related Questions