Skip to content

Commit

Permalink
Examples update
Browse files Browse the repository at this point in the history
  • Loading branch information
martinivanoff committed Sep 13, 2017
1 parent 1f3c9a0 commit 8edf8f8
Show file tree
Hide file tree
Showing 23 changed files with 156 additions and 152 deletions.
4 changes: 2 additions & 2 deletions ChartView/SL/MultipleAxes/MainPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@
<TextBlock Text="Shared Horizontal Axis"
HorizontalAlignment="Center"
Grid.Row="2"/>
<telerik:RadCartesianChart Palette="Metro"
<telerik:RadCartesianChart Palette="Windows8"
Grid.Row="3">

<telerik:RadCartesianChart.HorizontalAxis>
Expand Down Expand Up @@ -166,7 +166,7 @@
HorizontalAlignment="Center"
Grid.Row="2"
Grid.Column="1"/>
<telerik:RadCartesianChart Palette="Metro"
<telerik:RadCartesianChart Palette="Windows8"
Grid.Column="1"
Grid.Row="3">
<telerik:RadCartesianChart.HorizontalAxis>
Expand Down
2 changes: 1 addition & 1 deletion ChartView/SL/PieSeries/MainPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>

<telerik:RadPieChart Palette="Metro">
<telerik:RadPieChart Palette="Windows8">
<telerik:PieSeries ShowLabels="True"
RadiusFactor="0.7">
<telerik:PieSeries.DataPoints>
Expand Down
4 changes: 2 additions & 2 deletions ChartView/SL/Selection/MainPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
</Grid.ColumnDefinitions>

<telerik:RadCartesianChart x:Name="RadChart1"
Palette="Metro">
Palette="Windows8">
<telerik:RadCartesianChart.SelectionPalette>
<telerik:ChartPalette>
<telerik:ChartPalette.GlobalEntries>
Expand Down Expand Up @@ -44,7 +44,7 @@

<telerik:RadCartesianChart x:Name="RadChart2"
Grid.Column="1"
Palette="Metro">
Palette="Windows8">
<telerik:RadCartesianChart.SelectionPalette>
<telerik:ChartPalette>
<telerik:ChartPalette.GlobalEntries>
Expand Down
2 changes: 1 addition & 1 deletion ChartView/WPF/BindingToDataTable/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

<!--ChartView-->
<telerik:RadCartesianChart x:Name="chartView"
Palette="Metro"
Palette="Windows8"
Grid.Row="0">
<telerik:RadCartesianChart.VerticalAxis>
<telerik:LinearAxis/>
Expand Down
4 changes: 2 additions & 2 deletions ChartView/WPF/MultipleAxes/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@
<TextBlock Text="Shared Horizontal Axis"
HorizontalAlignment="Center"
Grid.Row="2"/>
<telerik:RadCartesianChart Palette="Metro"
<telerik:RadCartesianChart Palette="Windows8"
Grid.Row="3">
<telerik:RadCartesianChart.Resources>
<telerik:CategoricalAxis VerticalLocation="Bottom" x:Key="additionalHorizontalAxis" />
Expand Down Expand Up @@ -158,7 +158,7 @@
HorizontalAlignment="Center"
Grid.Row="2"
Grid.Column="1"/>
<telerik:RadCartesianChart Palette="Metro"
<telerik:RadCartesianChart Palette="Windows8"
Grid.Column="1"
Grid.Row="3">
<telerik:RadCartesianChart.Resources>
Expand Down
2 changes: 1 addition & 1 deletion ChartView/WPF/PieSeries/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>

<telerik:RadPieChart Palette="Metro">
<telerik:RadPieChart Palette="Windows8">
<telerik:PieSeries ShowLabels="True"
RadiusFactor="0.7">
<telerik:PieSeries.DataPoints>
Expand Down
4 changes: 2 additions & 2 deletions ChartView/WPF/Selection/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
</Grid.ColumnDefinitions>

<telerik:RadCartesianChart x:Name="RadChart1"
Palette="Metro">
Palette="Windows8">
<telerik:RadCartesianChart.SelectionPalette>
<telerik:ChartPalette>
<telerik:ChartPalette.GlobalEntries>
Expand Down Expand Up @@ -41,7 +41,7 @@

<telerik:RadCartesianChart x:Name="RadChart2"
Grid.Column="1"
Palette="Metro">
Palette="Windows8">
<telerik:RadCartesianChart.SelectionPalette>
<telerik:ChartPalette>
<telerik:ChartPalette.GlobalEntries>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
</PropertyGroup>
<PropertyGroup>
<SkipSdkExample>true</SkipSdkExample>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
Expand Down
2 changes: 1 addition & 1 deletion GridView/BindingToICustomTypeProvider/Readme.md
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>
23 changes: 17 additions & 6 deletions MSControls/ThemingExample/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -125,15 +125,26 @@
</StackPanel>
</Grid>
<Grid Margin="34,22,0,0" Grid.Column="2">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<telerik:Label FontFamily="Segoe UI" FontSize="14" Margin="-4,0,0,7" VerticalAlignment="Top" HorizontalAlignment="Left" Content="ScrollViewer"/>
<ScrollViewer Grid.Row="1" HorizontalAlignment="Left" MaxWidth="496" Height="333" BorderThickness="0,0,1,0" VerticalAlignment="Top" VerticalContentAlignment="Top" ScrollViewer.VerticalScrollBarVisibility="Visible">
<ScrollViewer Grid.Row="1" HorizontalAlignment="Left" MaxWidth="496" Height="200" BorderThickness="0,0,1,0" VerticalAlignment="Top" VerticalContentAlignment="Top" ScrollViewer.VerticalScrollBarVisibility="Visible">
<TextBlock Text="" Height="800" Opacity="0"/>
</ScrollViewer>
</Grid>
<telerik:Label FontFamily="Segoe UI" FontSize="14" Margin="-4,0,0,7" VerticalAlignment="Top" HorizontalAlignment="Left" Content="GridSplitter" Grid.Row="2"/>
<Grid Grid.Row="3" Margin="0 0 0 20">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="5"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition />
</Grid.ColumnDefinitions>
<GridSplitter Grid.Column="1" />
</Grid>
</Grid>
<telerik:Label Margin="28,0,0,7" FontFamily="Segoe UI" VerticalAlignment="Bottom" FontSize="14" Content="StatusBar"/>
<StatusBar Grid.Row="2" Grid.ColumnSpan="3">
<StatusBarItem>
Expand Down
25 changes: 11 additions & 14 deletions MaskedInput/IpAddress/Example.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,19 @@
<UserControl.Resources>
<local:IpPresentationToStringConverter x:Key="converter" />
</UserControl.Resources>
<Grid>
<Grid Width="600" Height="300" VerticalAlignment="Center">
<StackPanel Orientation="Horizontal" VerticalAlignment="Center">
<TextBlock Text="Ip Address" VerticalAlignment="Center" Margin="20 0 0 0"/>
<telerik:RadMaskedTextInput Grid.Row="0" x:Name="firstInput"
<Grid>
<StackPanel Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Center">
<TextBlock Text="IP Address" VerticalAlignment="Center" Margin="20 0 0 0" FontWeight="Bold" FontSize="14"/>
<telerik:RadMaskedTextInput Grid.Row="0" x:Name="firstInput"
Grid.Column="1"
Margin="10 5 10 5"
HorizontalAlignment="Stretch" TextMode="PlainText"
HorizontalAlignment="Stretch"
Mask="###.###.###.###"
Value="{Binding IpValue, Mode=OneWay, ValidatesOnExceptions=True, Converter={StaticResource converter}}"
Text="{Binding IpText, Mode=OneWayToSource, ValidatesOnExceptions=True, UpdateSourceTrigger=LostFocus}" />
<telerik:RadButton Content="Focus Catcher" Width="100" Height="30"/>
</StackPanel>
<TextBlock Text="Type 260.255.255.255 and click the button to see the validation tooltip" FontWeight="Bold" Width="500"
TextWrapping="Wrap" VerticalAlignment="Top"/>

</Grid>
Value="{Binding IpValue, Mode=TwoWay, UpdateSourceTrigger=LostFocus, ValidatesOnExceptions=True, Converter={StaticResource converter}}"
ValueMode="IncludeLiterals" />
<Button Content="VALIDATE!" Width="120"/>
</StackPanel>
<TextBlock Text="This IP Address is validated via simple byte validation rule - every portion should be in range 0-255. For more precise IP Address validation you can use System.Net.IPAddress class."
Margin="10" VerticalAlignment="Top" HorizontalAlignment="Center" TextWrapping="Wrap" Width="320"/>
</Grid>
</UserControl>
17 changes: 2 additions & 15 deletions MaskedInput/IpAddress/Example.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,17 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Windows.Controls;

namespace IpAddress
{
Expand All @@ -25,7 +12,7 @@ public Example()
InitializeComponent();
this.firstInput.DataContext = new ViewModel()
{
IpValue = new IpAddressPresentation(255, 255, 255, 255)
IpValue = new IpAddressPresentation(255, 255, 255, 255) { IsValid = true }
};
}
}
Expand Down
44 changes: 36 additions & 8 deletions MaskedInput/IpAddress/IpAddressPresentation.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace IpAddress
namespace IpAddress
{
public class IpAddressPresentation
{
Expand Down Expand Up @@ -39,9 +33,43 @@ public byte PartD
set;
}

public string IpFullString
{
get
{
return this.CompletePart(this.PartA.ToString()) + "." +
this.CompletePart(this.PartB.ToString()) + "." +
this.CompletePart(this.PartC.ToString()) + "." +
this.CompletePart(this.PartD.ToString());
}
}

public bool IsValid
{
get;
set;
}

public override string ToString()
{
return string.Format("{0}.{1}.{2}.{3}", PartA.ToString(), PartB.ToString(), PartC.ToString(), PartD.ToString());
return this.IpFullString;
}

private string CompletePart(string part)
{
if (part.Length == 3)
{
return part;
}
else if (part.Length == 2)
{
return "0" + part;
}
else if (part.Length == 1)
{
return "00" + part;
}
return string.Empty;
}
}
}
54 changes: 27 additions & 27 deletions MaskedInput/IpAddress/IpPresentationToStringConverter.cs
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;
}
}
}
2 changes: 0 additions & 2 deletions MaskedInput/IpAddress/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,4 @@
<Grid>
<local:Example />
</Grid>


</Window>
4 changes: 1 addition & 3 deletions MaskedInput/IpAddress/MainWindow.xaml.cs
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
{
Expand Down
6 changes: 4 additions & 2 deletions MaskedInput/IpAddress/Readme.md
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>
Loading

0 comments on commit 8edf8f8

Please sign in to comment.