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? 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!
An input dialog box is a simple GUI-based input that can be created by using the showInputDialog method defined in the JOptionPane class.
The simplest way to do it is to set an input equal to a variable for later use, and then call the variable later in the program. variable = str(input("Type into the text box."))
2.6 Dialog Boxes for Input /Output A dialog box is a small graphical window that displays a message to the user or requests input. Two of the dialog boxes are: – Message Dialog - a dialog box that displays a message. Input Dialog - a dialog box that prompts the user for input.
Creating a standard dialog is as simple as applying one the following methods to JOptionPane: showMessageDialog or showOptionDialog. The showMessageDialog method creates a basic one-button dialog box.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With