In WPF I am looking for a "do not show again" checkbox on my messagebox popup.
Does anyone know where I can get such a control or maybe how to copy the style of the regular WPF messagebox so I can create my own?
Thanks
Take a look at the Dialog Boxes Overview. The overview covers Message Boxes, Common Dialog Boxes, and Custom Dialog Boxes. In your case you'll want to create a simple Custom Dialog Box that includes a message, a checkbox, and however many buttons you need.
Basically you need to define a new code-behind file that includes your TextBlock, CheckBox, and Buttons in a panel object, and you need to extend Window. In your code-behind file you implement any necessary logic to implement the user's choice, and you return this result to the object containing the custom dialog box.
Make sure to pay special attention to this line of code when creating your custom dialog box:
// Open the dialog box modally
messageBox.ShowDialog();
The call to ShowDialog() will ensure that the user must take action against your dialog box before moving on to other parts of your application.
I think , you may have to create by yourself and it is really easy in the WPF
You could just use a dialog box. An easy way to do it would be to keep a variable in the project settings that would be updated on the popup close() event. So then you would just have to verify the value in the project settings before showing the popup.
Related
I have a Windows forms PropertyGrid and a customer UITypeEditor per http://msdn.microsoft.com/en-us/library/system.drawing.design.uitypeeditoreditstyle.aspx
Displays an ellipsis (...) button to start a modal dialog box, which requires user input before continuing a program, or a modeless dialog box, which stays on the screen and is available for use at any time but permits other user activities.
That ellipsis button is pretty small. How can I relabel it with a more helpful label?
Long story short, you can't. The basic MS PropertyGrid does not allow you to customize this text. It even uses a bitmap with 3 dots instead of text anyway and the width of the control is fixed.
Disclaimer: I'm the developer behind Smart PropertyGrid.Net, which can do what you want to achieve.
I am coding a C# forms application, and have a question in relation to the text property of a button where a messagebox is shown on the button's click event.
The button is a remove button that shows a messagebox where the user can press yes, no or cancel.
In the above situation, should the text of the button have the "..." characters following the text of the button?
With menuStrip items, and a form is displayed, the convention is to have the "..." characters after the text property of the menuStrip item. When following this convention, should the remove button have the same "..." characters.
One element of creating a good user interface is consistency. I assume that you want to create a user interface that is consistent with similar user interfaces on Windows.
Microsoft has published a user experience guide that contains the a guideline regarding using ellipsis with commands (buttons and menu items):
Indicate a command that needs additional information (including confirmation) by adding an ellipsis at the end of the button label.
So if your command opens a message box which requires further input or opens another dialog box where the user has to provide input you should use the ellipsis. But if the command doesn't open a secondary window, or the purpose of the command is to open a secondary window like an about box or a dialog box with options then no ellipsis should be used.
Microsoft provides a rationale for this design:
Proper use of ellipses is important to indicate that users can make further choices before performing the action, or even cancel the action entirely. The visual cue offered by an ellipsis allows users to explore your software without fear.
Your specific case where confirmation is required is included in the guideline that states that you should add ellipsis. Your users will know that they can invoke the remove button without fear.
In LightSwitch, when I open the default modal, calling the AddAndEditNew_Execute method, I want to change properties of the controls inside the modal dialog.
For instance: I want to change a TextBox to "Multiline" or change AutoComplete FilterMode to "Contains".
How can I access to those controls in execution time?
I know I can add a custom modal, but I just want to change a small thing of it and I don't want to create a whole modal dialog just for this.
I'm always talking about Silverlight client.
Thanks in advance.
I'm afraid that the only way you can do what you want is:
with a custom modal window (if you want the window to be modal)
or a separate screen (if you don't need the window to be modal)
The properties of a default modal window can't be changed. There are no mechanisms to change the properties of any of the controls.
The only thing that you can do is to influence which properties get displayed in the default modal window, by checking/unchecking the Display By Default check-box in the table designer.
But as soon as you need to make changes to either the layout of the controls, or changing any control's properties, you need to create a custom modal window, or separate screen, & display then by calling them in custom code.
The reason for this is because the controls for the default modal window are generated by the LightSwitch run-time.
It's really just a matter of a balance between not having to do the work to create the window, & flexibility.
Default: Easy = Yes, Flexible = No
Custom: Easy = No, Flexible = Yes
I know it's not what you wanted to hear, but hopefully my explanation helps you to understand why you can't do it the way you first wanted to.
I have a question? How can I wire up an button in a winform to take an input from a label, and put it in a text box to display the result?
I'm confused!
I have 4 labels... I want to be able to have people put input into the labels click the update button, and then display the results in the textbox below.
Any help? Thank you!
OK so basic outline of what you need to do:
1) Go to the toolbox and put textbox(es) on the form for the user to type in.
2) Add at least one label for your output text
3) Add a Button
4) Select each item on the form, go to its properties (f4) and set the Name property for each one to something that you can remember (this is how you'll reference the controls in your code)
5) Double click on the submit button. This will open up an "Event Handler" for Button.Click, which means the code you write will run when someone clicks the button.
6) Write the C# code to do what you want. For instance, this takes the contents of a textbox (tbInput.Text) and copies it to the label text (lblOutput.Text):
lblOutput.Text = tbInput.Text;
Hope this helps...if not, read the first 3 or 4 chapters of any beginning C# book.
You don't put input input into label, you do that in a TextBox. A label is a as its name implies a "label" (fixed unmodifiable text).
Most simply, create a method to handle the Click event of the button, bind it in.
Inside this method get the text from the labels, and then update the textbox with the input.
.NET standard Labels are not the controls you are looking for. Labels are just that...text labels that do not provide for text input. What you want is a TextBox, which you will be able to find in the Visual Studio Toolbox.
If you want the look and feel of a Label, but the functionality of a TextBox, you can modify the TextBox properties accordingly (border style, background color, etc).
Drop a Button onto your form, and from the Designer if you double-click the button, a _Click event handler will be generated in your source file from which you can implement the code to do whatever it is you want to do.
I want to implement a search box in a window form. In that window form, I have a few botton and a text box.
I want to support the use case when user enter a string in the search box and then we can find the that string and highlighted like firefox does. Is it hard to do this?
I googled and found this link that has the search box control. but I don't quite understand the code. If anyone is familiar with control.sendMessage, Could you please give me some help on understand that control.
here is the link:
http://social.msdn.microsoft.com/forums/en-US/csharpgeneral/thread/a07c453a-c5dd-40ed-8895-6615cc808d91/
Thanks
There is no single WinForms or Windows control that provides this functionality. You need to break the problem down into parts:
1) Create a search box
I believe the link you give adds the "Search" cue to a textbox but doesn't add the search button(?) - if that is the case you'll want to combine the textbox with a new button in a user control.
SendMessage sends a message to a Windows control or Window. In this case it tells the textbox to display the "Search" cue. You need to do this because this behaviour is not exposed by the WinForms controls.
2) Work out how to highlight sections of the text
If you are just using the WinForms controls you'll need to use a RichTextBox control and work out how to change the background color at various points in the text.