WPF - FIND method for TextBox? - wpf

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!

Related

VS 2012 Coded UI Testing and WPF User Control

I have an application that uses a UserControl inside of a Window, Coded UI Testing recognizes everything in the Window (buttons, etc.) but inside the UserControl I just get a blue box around the area and cannot select anything inside for recording.
I've been all over google for this issue and I think it has to do with the AutomationPeers (?). Any suggestions would be useful in how to get these elements visible to Coded UI
If the custom control doesn't provide a customized/override version of the OnCreateAutomationPeer, you can't. You need to ask developers to implement automation support for their control.
UPDATE:
My issue was that Coded UI couldn't see past my TabControl (displays different user controls). I followed this solution to create a CustomTabControl and override the OnCreationAutomationPeer() method so that the lower elements could be displayed.
[ click here ]

Creating a walk through in WPF

I'm trying to add a "walk-through" mode to my existing WPF project which will guide the user through the process of using my application. Trying to look this up is difficult, because every Google search for "WPF walk through" returns a walk-through on how to use WPF!
I've thought of something like using tooltips and programmatically controlling when they are visible for each control in the GUI ("Press this button next, etc") but I'm hoping for suggestions on a better way as I'm still pretty new to WPF.
Thanks,
Mike
I would use Popup.
Just show same popup with different content near to interested controls
What you appear to be looking for is a wizard... check this one out:
Extended WPF Toolkit™ Community Edition

How to implement the standard Windows Phone 7 ComboBox replacement UI

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

How would I create a silverlight control for tagging content similar to StackOverflow?

I am new to Silverlight. How would I go about creating a control for users to tag content.
I would like it to work like it does it StackOverflow i.e. Autocomplete and when you press space it inserts the tag in a box with a remove button. I want the control to be bindable to a collection of strings.
If someone can just point me in the right direction to get me started I would be very grateful.
You need to start with an AutoComplete Textbox, there is already one available in the Silverlight Toolkit. Tim Heuer has several examples using it (he actually creates one himself in one of his posts somewhere), you can find one sample here. Once you have this in place, the rest of the control is pretty simple.

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/

Resources