I understand that there is no default input dialog in silverlight for windows phone 7. But i need this for my project.
I want it to have the same metro look as the default messagebox class. Whats the easiest way to do this? Can i extend the messagebox class and add som kind of textfield to it? 开发者_Python百科Or should i perhaps use popup or child window?
Please help my out on this one guys :) Stack overflow has been a great asset and has helped me alot when I get stuck in my projects!
You could use InputPrompt from the Coding4Fun Toolkit:
InputPrompt prompt = new InputPrompt();
prompt.Title = "Here Is A Title";
prompt.Message = "Specify a unique message:";
prompt.Show();
prompt.Completed += (pResult,sResult) =>
{
}
Or you could use the CustomMessageBox
from WPToolkit:
CustomMessageBox box = new CustomMessageBox()
{
Caption = "Your Caption Here",
Message = "Enter a unique message",
LeftButtonContent = "ok",
RightButtonContent = "cancel",
Content = textBox
};
box.Dismissed += (s, boxEventArgs) =>
{
}
box.Show();
Both are great options and at the end of the day it will be a matter of preference as to which one to use for your specific case.
I used to see a NotificationMessageBox; I'm not use if it works. If there is really no existing control to use, I would rather use Popup to make my custom dialog. You can use text box there. :)
I published a blog post about Customizing MessageBox on Windows Phone 7, which might help. Another alternative woudl be to use the InputPrompt
from the Coding4Fun Toolkit.
use messagePrompt from Coding4FunToolkit for WP...
you can do it like this:
MessagePrompt p = new MessagePrompt();
p.Body = (any UserControl(customized), string, etc.)
p.Show();
精彩评论