WPF MVVM ComboBox Binding to XML Data.

Once again, while browsing StackOverflow.com, I came across a question from a user who needed to fix their ComboBox Binding. The user in question was Binding XML data in Key/Value pairs to the combo box, displaying the Key and wanted to retrieve the Value. This was achieved using the following example;My XML Test Data was [...]

By |2013-01-24T17:15:00+00:00January 24th, 2013|Binding, MVVM, VB.net, WPF, XML|0 Comments

MVVM WPF Validating multiple items together

In an application I am developing, I required that two checkboxes be validated together, when either one of them were clicked. I also needed to only show the Validation error once in my Error Message Box. To achieve this we first call the OnPropertyChanged routine, which in turn raises the PropertyChanged event, for each linked [...]

By |2017-03-25T07:46:17+00:00January 7th, 2013|.Net Framework, MVVM, Tips, Validation, VB.net, WPF, XAML|0 Comments

Instantiating a Generic Type of T

I found a requirement recently where I needed to Instantiate a new instance of a Generic Type. Ordinarily we would declare a new instance of a class using a Generic Type using something like; Public Class ViewModel_Class(Of T) However, If we then try to create a new Object of Type T by performing the following… [...]

By |2017-07-24T08:33:18+01:00January 7th, 2013|.Net Framework, VB.net|0 Comments

Validating an Email Address

In order to validate an email address, use the following function; Public Function IsValidEmailAddress(ByVal EmailAddress As String) As Boolean Dim Expression As New System.Text.RegularExpressions.Regex("S+@S+.S+")  If EmailAddress = "" Then  Return True  Else  Return Expression.IsMatch(EmailAddress)  End If End Function

By |2013-01-07T14:00:00+00:00January 7th, 2013|.Net Framework, Validation, VB.net, Web|0 Comments

WPF – Restricting Text Entry to Numeric Characters, the MVVM Way

I needed to Limit several TextBoxes in my WPF MVVM application to only allow Numeric Characters. I stumbled upon a very useful post by Jermey Likeness which described a method using Attached Behaviours, which worked well for me; http://csharperimage.jeremylikness.com/2009/10/silverlight-behaviors-and-triggers_07.html I modified this code slightly to allow for Decimal point control also. The VB.net Code is [...]

By |2017-07-24T08:33:18+01:00January 1st, 2013|.Net Framework, MVVM, Tips, VB.net, WPF|0 Comments