Add controls to NotificationBox

Dec 21, 2012 at 9:23 PM
Edited Dec 21, 2012 at 9:27 PM

Hi there, I'm new into WP development and I want to ask a question.

Is there any way to add another control to your NotificationBox?

Something like a textbox and some other things.


Thank you for the reply :)



I'm trying with something like

                "Choose an option.",
                new NotificationAction(new TextBox(), () => {}),
                new NotificationAction("Save", () => { }),
                new NotificationAction("Load", () => { }));
but this will make the textbox stay on the same line of the buttons, and them to be down!

Dec 22, 2012 at 7:16 AM

Yes you can. Create your own message box ControlTemplate based on the one located inside the relevant Generic.xaml file.

Set ContentControl.ContentTemplate to use different DataTemplate.

I know it's not perfect, it works.

Dec 22, 2012 at 9:39 AM

Yeah, it works!


Is there any way to access the content of the textbox from outside?

Something like

new NotificationAction("Xxx", () => { doSomething(textBoxContentHere); }),

Dec 22, 2012 at 9:48 AM

No, since it separates presentation, and you don't really want to have the visual tree in your view-model.

In your case I may think about extending the NotificationAction with additional parameters, then bind these parameters to the visual element.