forked from telerik/xaml-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1f3c9a0
commit 8edf8f8
Showing
23 changed files
with
156 additions
and
152 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
##Binding to ICustomTypePovider## | ||
This example demonstrates how an object implementing the ICustomTypePovider interface can be defined and bound to RadGridView. | ||
In WPF the interface is available only in .NET 4.5 or higher. | ||
In WPF the interface is available only in .NET 4.5 or higher and to run the example you should open in Visual Studio and replace the existing binaries with the ones in the WPF45 folder. | ||
|
||
<KeyWords: bind, icystomtypeprovider, dynamic> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,46 +1,46 @@ | ||
using System; | ||
using System.Linq; | ||
using System.Globalization; | ||
using System.Windows.Data; | ||
|
||
namespace IpAddress | ||
{ | ||
public class IpPresentationToStringConverter : IValueConverter | ||
{ | ||
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) | ||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) | ||
{ | ||
if (value == null) | ||
{ | ||
return string.Empty; | ||
} | ||
else if (value is IpAddressPresentation) | ||
{ | ||
IpAddressPresentation ipAddress = value as IpAddressPresentation; | ||
return this.CompletePart(ipAddress.PartA.ToString()) + this.CompletePart(ipAddress.PartB.ToString()) + | ||
this.CompletePart(ipAddress.PartC.ToString()) + this.CompletePart(ipAddress.PartD.ToString()); | ||
} | ||
return string.Empty; | ||
return ((IpAddressPresentation)value).ToString(); | ||
} | ||
|
||
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) | ||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
IpAddressPresentation ipObject; | ||
|
||
private string CompletePart(string part) | ||
{ | ||
if (part.Length == 3) | ||
{ | ||
return part; | ||
} | ||
else if (part.Length == 2) | ||
if (!this.TryParseIpString(value.ToString(), out ipObject)) | ||
{ | ||
return "0" + part; | ||
ipObject.IsValid = false; | ||
} | ||
else if (part.Length == 1) | ||
else | ||
{ | ||
return "00" + part; | ||
ipObject.IsValid = true; | ||
} | ||
return string.Empty; | ||
|
||
return ipObject; | ||
} | ||
|
||
private bool TryParseIpString(string ipText, out IpAddressPresentation ipAddressObject) | ||
{ | ||
bool result; | ||
string[] parts = ipText.Split(new char[] { '.' }); | ||
|
||
byte partA = 0, partB = 0, partC = 0, partD = 0; | ||
|
||
result = (byte.TryParse(parts[0], NumberStyles.Integer, CultureInfo.InvariantCulture, out partA) && | ||
byte.TryParse(parts[1], NumberStyles.Integer, CultureInfo.InvariantCulture, out partB) && | ||
byte.TryParse(parts[2], NumberStyles.Integer, CultureInfo.InvariantCulture, out partC) && | ||
byte.TryParse(parts[3], NumberStyles.Integer, CultureInfo.InvariantCulture, out partD)); | ||
|
||
ipAddressObject = new IpAddressPresentation(partA, partB, partC, partD); | ||
return result; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,6 +13,4 @@ | |
<Grid> | ||
<local:Example /> | ||
</Grid> | ||
|
||
|
||
</Window> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,4 @@ | ||
using System; | ||
using System.Linq; | ||
using System.Windows; | ||
using System.Windows; | ||
|
||
namespace IpAddress | ||
{ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
##Ip Address## | ||
The IP address demo shows how you can set up an IpAddressViewModel and validate it on user Input. The IpAddressViewModel validates with separating the 4 parts into 4 byte properties and also validates with System.Net.IpAddress class. | ||
The IP address demo shows how you can edit an IP Address with MaskedTextInput and validate it. | ||
Demo uses the ValueMode property of the MaskedTextInput so that decimal separators of the IP Address are included in the Value property. | ||
This makes it easier to parse and validate the address. | ||
|
||
<keywords: ipaddress, databinding, mvvm, validatesonexceptions, maskedtextinput, validation> | ||
<keywords: ipaddress, databinding, mvvm, validatesonexceptions, maskedtextinput, validation, ValueMode> |
Oops, something went wrong.