Wednesday, October 17, 2012

Setting content for CustomMessageBox

Setting content for CustomMessageBox

I have the following:

private void confirmaPagamentoMultibanco(Double valor)         {             CustomMessageBox msgbox = new CustomMessageBox()             {                 Caption = "Pagamento Multibanco",                 Message = "Use os seguintes dados para efectuar o pagamento Multibanco.",                 Content = createMBGrid(valor),                 LeftButtonContent = "Pagar",                 RightButtonContent = "Cancelar"             };             msgbox.Show(); } 

And the function createMBGrid as follows:

private Grid createMBGrid(Double valor)         {             Grid content = new Grid();             ColumnDefinition firstC = new ColumnDefinition();             ColumnDefinition secondC = new ColumnDefinition();             content.ColumnDefinitions.Add(firstC);             content.ColumnDefinitions.Add(secondC);             RowDefinition firstR = new RowDefinition();             RowDefinition secondR = new RowDefinition();             RowDefinition thirdR = new RowDefinition();             content.RowDefinitions.Add(firstR);             content.RowDefinitions.Add(secondR);             content.RowDefinitions.Add(thirdR);             TextBlock entTitle = new TextBlock();             entTitle.Text = "Entidade:";             entTitle.Margin = new Thickness(20, 0, 0, 0);             entTitle.FontWeight = FontWeights.Bold;             Grid.SetColumn(entTitle, 0);             Grid.SetRow(entTitle, 0);             return content; } 

And yet the CustomMessageBox only shows the Message and Buttons, not the content. I cant figure out what I am doing wrong. (first time creating a grid in code-behind, maybe that's why)

Thanks for all the help in advance.

Answers & Comments...




No comments:

Post a Comment

Send us your comment related to the topic mentioned on the blog