How to implement the standard Windows Phone 7 ComboBox replacement UI - combobox

I'm trying to implement what seems to be the standard UI replacement for comboboxes in Windows Phone 7. This is the TextBox + Navigate to New Page with Listbox approach you can see in the settings page of the Emulator.
I got the following issues while trying to implement this approach, speficically related to the TextBox:
If I use a ReadOnly TextBox the text appears in light gray, which is not really what I want. I want the normal black font there.
If I don't use a ReadOnly TextBox the virtual phone keyboard will appear in some rare situtations, even when I handled the MouseEnter event. I can't consistently reproduce the situations when the keyboard appears.
Which is the best approach to implement this behaviour?

The Windows Phone Toolkit has a ListPicker that is quite flexible and easy to use.

Have you considered just using a TextBlock with an invisible button over the top? Or associate a gesture to take the tap event?
You could also check out Alex's implementation here of a picker box.
Implementing Picker Box functionality on WP7. - Alex Yakhnin's Blog

Related

How to get button default style under windows 10?

Looking to my first steps with WPF on Windows 7 I was very pleased. Seeing it on Windows 10 I was very surprised. The buttons didn`t looks like expected. Trying it with WinForms results in the expected look an feel.
Here my problem:
So my question:
How can I get the "normal" style of the default button (OK has IsDefault=true) with the expanded blue border for the button even when it has focus, without defining the button-style myself?
This is very important in case of setting the focus to the Cancel-button programmatically, because in this case the dotted border will not be displayed, so on Win 10 the user can not know witch button will be pressed by enter.
You can get similar button styles using Windows UWP.
In WPF, you can check out the Modern UI(MUI) in MSDN site.
It can produce similar results. I have been working with mui for a couple of months and it really helped me to satisfy my client who wanted to have a Windows 10 like UI experience. I had to create tiles like in start menu also. MUI did a great job for me.
Get the MUI from Github. Modern UI for WPF
Also I had tried devexpress and telerik controls. Have a look at them too.

WPF - FIND method for TextBox?

After using a Windows Forms RichTextBox, I realized that WPF TextBoxes do not have the .Find Method (as mentioned here). I do not wish to use a WPF RichTextBox as it causes performance issues when I host the element in Windows Forms using HostElement. The WPF TextBox was the way to go in terms of hosting it in Windows Forms
I've heard a lot about Global Search for WPF but I do not wish to implement that feature. Basically what I want is a basic Find method for a WPF textbox. It should consist of a TextBox and a Button. The TextBox is used to enter the string you want to find and the Button should be the command for the Find Method to activate. Each time the user clicks on the Button, the Find method jumps to the next searched result and the next and the next... and act as a loop.
Can someone please help me with this.
I managed to solve the problem by using Regular Expression!

Is there a ChildWindow equivalent on Windows Phone 7? How to do rich modal popups

I'm developing a phone app and need a modal dialog with some "rich" content - a few text boxes and a drop down. OK, not very rich but more than a MessageBox. :>
In regular Silverlight I know there's the ChildWindow control - but can't find the equivalent in Phone 7.
How have other folks done rich popup dialogs on the phone?
Thanks!
Silverlight actually has a control called a Popup. Here's the MSDN documentation.
It's incredibly simple to use (just set IsOpen to true to dispay) and quite effective. The only reason you might use a Panel with manual state control would be is you want precision control over animations etc.
Where I've seen people implement something like this they just have added a panel to the page and made this visible to act as a modal popup.
If you do this, be sure to handle use of the back button correctly.
Actually, there is ChildWindow on Windows Phone 7 in System.Windows.Controls library.
These are some examples:
http://www.c-sharpcorner.com/uploadfile/raj1979/how-to-implement-childwindow-in-windows-phone-7/
http://blog.deepwire.co.uk/?p=434
http://www.31a2ba2a-b718-11dc-8314-0800200c9a66.com/2011/06/how-to-create-childwindow-login-popup.html

Silverlight 3: How to implement Textblock copy/paste functionality?

Silverlight is awesome, most of my application users are giving positive feedback about silverlight. However some of the users are not able to live without copy/paste functionality. They are very much used to copy/paste functionality provided by HTML page out of the box.
How can I implement such a context menu as well as copy/paste functionality?
PS: Windows only solution is fine too.
Aside from using TextBox with IsReadOnly=true, you'll have a pretty hard time trying to simulate selection and copy/paste in a TextBlock. I would identify the areas they wish to copy/paste the most and use TextBox's there. You could even remove the border and make a transparent background and it should look nearly identical to adjacent TextBlock's.
If you do that then you will get the selection and copy functionality provided by TextBox and it works across browsers.
Otherwise you will need to go through the browser's DOM to put stuff on the clipboard and that will be a pain because of cross-browser concerns. Silverlight 4 adds a Clipboard API if you're able to start development with a beta version.
As Josh has answered, style a TextBox to look like a TextBlock. In terms of copy and paste:
Assuming the users aren't content with just CTRL+C, CTRL+X or CTRL+V - you can now access the clipboard in Silverlight 4:
string content = Clipboard.GetText();
Clipboard.SetText("hello world");
A context menu can be done in various ways, and in Silverlight 4 it is actually properly supported cross browser instead of just IE. You could do it with a Popup or a ChildWindow or just use one from the Vectorlight library:
This open source project on Codeplex contains a demo that does just that and much more:
http://sl4popupmenu.codeplex.com/

Is it possible to simulate keystrokes in Silverlight (similar to SendKeys)?

Is it possible to build a Silverlight application with an embedded on-screen keyboard that is context aware (e.g. on-screen keyboard appears only when a textbox is in focus).
Yes, but you need additional javascript that will show\hide the silverlight app.
For example: User focuses password textbox, javascript fires showing your app. Click on app's virtual keyboard raises javascript that edits textbox.
HTH
I was looking for the same thing, so I created a Virtual Input Keyboard that can attach to Textboxes and other controls - have a look here:
http://www.orktane.com/Blog/post/2009/11/09/Virtual-Input-Keyboard-Behaviours-for-Silverlight.aspx
Hope that helps, 5 months late though :)
Andrius Mudinas open sourced an excellent Silverlight on-screen keyboard:
http://www.mudinas.com/post/2009/07/10/Silverlight-Keyboard-Control.aspx
We've integrated this into our own Silverlight app. Remember to copy the keyboard styling from their App.xaml to your project's App.xaml.
You can wire into the KeyPressed event.

Resources