Message Box yesnoButtons in windows phone 7.5 - c#

In window phone 7.5 . I want to use yes no buttons in message box . But there is no option for yes no buttons in message box. How can i use with yes no buttons or other alternate to show caption (OK =yes and cancel =no)
Please help me.
Thanks in advance.

You can use the Coding4Fun MessagePrompt to create Yes/No message with custom buttons in this way:
MessagePrompt messagePrompt = new MessagePrompt();
messagePrompt.Message = "Some Message.";
Button yesButton = new Button() { Content = "Yes" };
yesButton .Click += new RoutedEventHandler(yesButton _Click);
Button noButton = new Button() { Content = "No" };
noButton .Click += new RoutedEventHandler(noButton _Click);
messagePrompt.ActionPopUpButtons.Add(noButton);
messagePrompt.ActionPopUpButtons.Add(yesButton );
messagePrompt.Show();

Another option is to use the Guide class from the XNA framework. There is a BeginShowMessageBox method giving you the option to pass in whatever strings you wish for the buttons.

The other option is to use MessagePrompt from Coding4fun toolkit and customize according to your needs

Yes, the problem with WP MessageBox is that it only supports the OK and OKCancel MessageBoxButton, which means that you’re limited to either an ok button or an ok and a cancel button. The YesNo and YesNoCancel enumeration values are not supported.
Basically you can try to display a semi-transparent blanking layer over the page content, and then display a custom message box on top of that. Here, you can find a complete sample.
Another option is to use a custom library like Windows Phone Assets.

Related

C# WindowsAPICodePack CommonOpenFileDialog is there any way to customize buttons (Open/Save/Hide)?

I found this solution that let me customize the OK button (SetOkButtonLabel). But I need to make the Open/Save button invisible and change the label of the Cancel button. I found this documentation:
https://learn.microsoft.com/en-us/windows/win32/api/shobjidl_core/nf-shobjidl_core-ifiledialogcustomize-removecontrolitem
https://learn.microsoft.com/en-us/windows/win32/api/shobjidl_core/nf-shobjidl_core-ifiledialogcustomize-setcontrollabel
But I can't get it work since I don't know how am I suppose to identify the controls within this Windows-Dialog. Btw, I'm not using this dialog as a FolderPicker...
Screenshot
This is what I tried:
var r3 = new ReflectorX("System.Windows.Forms", "System.Windows.Forms");
Type typeIFileDialog = r3.GetType("FileDialogNative.IFileDialogCustomize");
r3.Call(typeIFileDialog, nativeDialog, "SetControlLabel ", new object[] { "[???]" });
Does anyone have done this before? any hints?
Thank you !!

Hide button text behind button image

Is there any method to hide a button text behind button image like bring to front or send to back option?
I only need to hide or show button image only as I have a code that coverts the original text CloseButton.text = "&Close"; to CloseButton.Text = "&Cancel";
to perform another command so I can't use CloseButton.Text = "";.
Tried this link - WinForms button with image and text but my button size is too small that it would only show the text and not the image no matter how I mix and match TextAlign and ImageAlign.
Any help is much appreciated. Thanks in advance.
Sample Button Size below:
Check this
Place Textbox in Button and set textbox.visible=false method
Is there any method to hide a button text behind button image like
bring to front or send to back option?
There is no such built in but you can simply clear out the text on click event of the controls. Example: if you have radio buttons for send to back then on click of that clear out the control text saying controlId.Text = string.Empty
As #Rotem posted in the comments.
Have your code behind use the Tag property rather than Text. Easiest way out is using properties for what they were made for.
Instead of using CloseButton.text = "&Close"; I changed it to CloseButton.Tag = "&Close"; and made my code worked around it to have the same function without placing an actual Text in my Buttons. Credit this asnwer to #Rotem. Thanks.

Customised dialog box with Xamarin Forms

I need to be able to make this kind of dialog box to be displayed when a button is pressed. I am using Acr.UserDialogs for simple dialog boxes but I don't think there is any way to get such a dialog using this library.
Any ideas on how I can do this in Xamarin Forms?
You can use the Popup plugin to display a page modally
You can create your own layout and use this awesome plugin to display your layout as popup
https://github.com/rotorgames/Rg.Plugins.Popup
How To Use --snippet from the link
Open new PopupPage
Task PushAsync(PopupPage page, bool animate = true) // Navigation.PushPopupAsync
Hide last PopupPage
Task PopAsync(bool animate = true) // Navigation.PopPopupAsync

Windows mobile button text new line

I need to have new line in button.text in Windows Mobile 6,5. I have following code
this.button1.Text = "some \r\n one";
Even if I try
this.button1.Text = "some" + Enviroment.NewLine + "one";
I can't see second line in my button. I see only some. I tried to resize my button but It doesn't effect on it.
Any Ideas?
Thanks
The Button control does not support Multiline input.
Compact Framework does not support multiline text (BS_MULTILINE) although it is supported by C/C++: http://msdn.microsoft.com/en-us/library/windows/desktop/bb775951%28v=vs.85%29.aspx.
You may use this solution: http://social.msdn.microsoft.com/Forums/en-US/vssmartdevicesvbcs/thread/67664186-e61c-4510-8414-939fce37a30c
The better way is to use a image in which you have the TEXT.
Instead of the button use a picture box and add the codes to the click event of picture box.

Similar to alt tag in WinForms controls

Maybe that's a noob question but is there a way to have an yellow tooltip alike web alt while using web browser in winform application controls such as checkBox or Button ?
ToolTip tooltip = new ToolTip();
tooltip.SetToolTip(checkBox, "A tooltip on my checkBox");
tooltip.SetToolTip(button, "A tooltip on my button");
There's a tooltip you can add to buttons etc. in WinForms - is that what you mean?
If so there's a tutorial on Code Project. Basically you need this code:
private System.WinForms.ToolTip m_wndToolTip;
this.m_wndToolTip = new System.WinForms.ToolTip (this.components);
m_wndToolTip.SetToolTip (PictureButton, "Click Me!");
m_wndToolTip.SetToolTip (m_wndIntTextBox, "Enter Integer data type value.");
If you press F4 you will get the controls options in that go to the bottom and you will find a tooltip option and give your message there and it appears when you run the application and you'll find the tooltip when you hover the mouse over the button or what ever it might be.
You want a tooltip. See this MSDN article.

Categories

Resources