Im developing an application for the windows store in c#, and wondering whats the best way to dynamically validate data in controls such as Textboxes, Dropdown boxes etc.
At the minute I usually check the validation when a buttons clicked, I would like to be able to notify the user in realtime.
An example of where i would like this to be used in when a user registers with an email address I would like to check the format of the string using a regex command.
Any assistance would be appreciated
you can use relay command
eg Relay Command and MVVM pattern
Related
I am currently working on a Windows Presentation Foundation app and I need to make use of Message boxes. I want to get few information from user inside Message Box popup.
But they appear always like this:
But I think the actual look of it should be like that:
Does anybody know, why this is, and how to solve it? I tried all everything listed
here
, but nothing worked.
I agree with Keithernet, build your own. Its more of an Input Dialog box. You may want to plan it to create a window, create it with ex: 4 parameters which you could override so you can apply them in the form including
The title,
The prompt you want the user to fill in
optional default button 1 text
optional default button 2 text.
have the input value stored into a public property in the window for the text to be bound to during entry.
If the user clicks the cancel button (or similar), clear the text entry and close the window. If ok button, just close the window.
Then, when you call it with a YourWindow.ShowDialog(), upon return, you can look at the public property for that input text value.
You could even do with a property / flag if the user cancelled directly or not. I have done similar in a couple of my WPF apps.
MessageBox is very limited. Based on your screenshot, you should just create your own child Window with your own XAML so you can get the user input.
You can find sample service implementations/NuGets for this on GitHub. Here is one I've created sometime ago: https://github.com/Dirkster99/MsgBox
Just create your own is an oversimplifying statement in my opinion because this is usually a dialog that you want to show in different parts of the application. Therefore, you have to settle for a software design pattern (I chose a service implementation as suggested here).
Likewise, there are other design decisions that should be taken. I have for instance made sure that the API has a compatible subset of Show API calls with the standard .Net MessageBox to make its application as flexible as possible. I also settled for light and dark themes hoping this will make its application easy in any other theme...
We need to implement a universal autocomplete for users at our company. Basically when someone starts with # and then types a name, we want to help them with autocomplete options (some sort of list showing).
This needs to work in any application in windows.
The plan is capture all keypresses, look for the # character, and if they have typed that start helping them with the autocomplete. If they select an option then we SendKeys the rest of the name down to the current cursor location, thereby finishing the name for them.
We have the keypress part working, but we aren't sure how to display the autocomplete feature. How can we implement a UI for this with the Win32 API?
Edit controls have the IAutoComplete and you can also use UWP TextBox and AutoSuggestBox.
I want to perform validations for TextBoxes in WPF.
Validations are like,
1) Checking Emptiness of a Control
2) validating Email Address
3) validating Mobile Number
I know How to handling all kind of validations in Asp.Net.
But Don't know in WPF.
Till now I am handling from code behind but I think that is not correct way.
I want to perform validations after Click Event just like in our Asp.Net.
Please give me your valuable suggestions.
I'm writing a Windows 8 Metro app with a GridView with several pages worth of items. I'd like to provide the user with an incremental-search kind of filtering capability. I'm thinking it would pop up a text field as soon as the user starts typing.
I thought that implementing the search contract might be the way to accomplish this, but it doesn't appear to have the incremental behavior I'm looking for.
Anyone know of an example of something like this?
Thanks.
You can wire into the SuggestionsRequested event from the SearchPane.getForCurrentView(). As the user types, you could process each key stroke and filter the data you are displaying in the Grid.
Having said that, filtering is usually implemented directly in the UI and not via the Search contract. Thus, I like your idea of going with a text field and processing each keystroke.
I want to be able to use the .NET WebBrowserControl to record and repeat user actions to automate the collection and retrieval of text from web pages for a data extraction tool that I'm building, but am unsure about how to best approach this.
I specifically want to use the .NET WebBrowserControl as it can be embedded in a .NET form and also used within a server side process without a UI. I'm aware that there are other means of recording and repeating user actions such as Selenium, but for now I am interested in a solution around the web browser control (just to keep answers focused).
Actions to be recorded are those such as button clicks, drop down list selection, link clicks etc.
Potential solutions I have looked at so far:
(Please correct me if my notes based on brief evaluations are wrong)
iMacro (doesn't appear to have a component that can be used within a project, to record user actions, rather the GUI has to be used).
WaitN - Good for programmatic play back - but no recording facility that can be hooked up to the web browser control?
I'm presuming this is possible as services like Mozenda appear to make use of the WebBrowserControl, or some IE like version based on mshtml.dll.
Are there any other options I can look at?
Any insight would be appreciated.
yap, as in Mozenda ,when user create any action like goto mainpage>click on images>download image etc... the XPath is recorded with the each page url into XML file. So, use self learning algorithm to implement such kind of XML better way than mozenda.
i have developed one application using JSOUP and Regular Expression Parsing works same as mozenda do. i created the configuration file which contains the XPath of all the items you want . Which works great for me.
Hope this helps,