Skip to content

Commit

Permalink
New version of Telerik SDK examples.
Browse files Browse the repository at this point in the history
  • Loading branch information
PetiaVladova committed Oct 23, 2020
1 parent a2394b4 commit cd38440
Show file tree
Hide file tree
Showing 33 changed files with 1,381 additions and 0 deletions.
86 changes: 86 additions & 0 deletions NavigationView/HierarchicalDataBinding/App.xaml
@@ -0,0 +1,86 @@
<Application x:Class="HierarchicalDataBinding.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
StartupUri="MainWindow.xaml">
<Application.Resources>
<DataTemplate x:Key="EditorsTemplate">
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock Text="Visit the UI for WPF " />
<telerik:RadHyperlinkButton NavigateUri="https://docs.telerik.com/devtools/wpf/introduction" Content="documentation" TargetName="_blank" />
<TextBlock Text=" to learn more about the different editors in the suite." />
</StackPanel>
</DataTemplate>
<DataTemplate x:Key="LayoutControlsTemplate">
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock Text="Visit the UI for WPF " />
<telerik:RadHyperlinkButton NavigateUri="https://docs.telerik.com/devtools/wpf/introduction" Content="documentation" TargetName="_blank" />
<TextBlock Text=" to learn more about the different layout controls in the suite." />
</StackPanel>
</DataTemplate>

<DataTemplate x:Key="RadComboBoxTemplate">
<Grid VerticalAlignment="Center" HorizontalAlignment="Center">
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>

<telerik:RadComboBox ItemsSource="{Binding EditorItemsSource}" EmptyText="Select a country" />
<StackPanel Orientation="Horizontal" Grid.Row="1" Margin="0 50">
<TextBlock Text="Visit the RadComboBox " />
<telerik:RadHyperlinkButton NavigateUri="{Binding DocumentationLink}" Content="documentation." TargetName="_blank" />
</StackPanel>
</Grid>
</DataTemplate>
<DataTemplate x:Key="RadAutoCompleteBoxTemplate">
<Grid VerticalAlignment="Center" HorizontalAlignment="Center">
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>

<telerik:RadAutoCompleteBox ItemsSource="{Binding EditorItemsSource}" SelectionMode="Single" WatermarkContent="Select a country"/>
<StackPanel Orientation="Horizontal" Grid.Row="1" Margin="0 50">
<TextBlock Text="Visit the RadAutoCompleteBox " />
<telerik:RadHyperlinkButton NavigateUri="{Binding DocumentationLink}" Content="documentation." TargetName="_blank" />
</StackPanel>
</Grid>
</DataTemplate>
<DataTemplate x:Key="PersonTemplate">
<StackPanel>
<TextBlock Text="{Binding Name,StringFormat=Name: {0}}" />
<TextBlock Text="{Binding Age,StringFormat=Age: {0}}" />
</StackPanel>
</DataTemplate>
<DataTemplate x:Key="RadTileViewTemplate">
<Grid VerticalAlignment="Center" HorizontalAlignment="Center">
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<telerik:RadTileView ItemsSource="{Binding LayoutControlItems}" DisplayMemberPath="Name" ContentTemplate="{StaticResource PersonTemplate}" MaximizeMode="Zero"/>

<StackPanel Orientation="Horizontal" Grid.Row="1" HorizontalAlignment="Center" Margin="0 50">
<TextBlock Text="Visit the RadTileView " />
<telerik:RadHyperlinkButton NavigateUri="{Binding DocumentationLink}" Content="documentation." TargetName="_blank" />
</StackPanel>
</Grid>
</DataTemplate>

<DataTemplate x:Key="RadTileListTemplate">
<Grid VerticalAlignment="Center" HorizontalAlignment="Center">
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<telerik:RadTileList ItemsSource="{Binding LayoutControlItems}" DisplayMemberPath="Name" ItemTemplate="{StaticResource PersonTemplate}" />

<StackPanel Orientation="Horizontal" Grid.Row="1" HorizontalAlignment="Center" Margin="0 50">
<TextBlock Text="Visit the RadTileList " />
<telerik:RadHyperlinkButton NavigateUri="{Binding DocumentationLink}" Content="documentation." TargetName="_blank" />
</StackPanel>
</Grid>
</DataTemplate>
</Application.Resources>
</Application>
16 changes: 16 additions & 0 deletions NavigationView/HierarchicalDataBinding/App.xaml.cs
@@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Windows;

namespace HierarchicalDataBinding
{
/// <summary>
/// Interaction logic for App.xaml
/// </summary>
public partial class App : Application
{
}
}
147 changes: 147 additions & 0 deletions NavigationView/HierarchicalDataBinding/HierarchicalDataBinding.csproj
@@ -0,0 +1,147 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
<ProductVersion>8.0.30703</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{9BA06090-A5AD-4C09-B4F0-3F90D6F075E4}</ProjectGuid>
<OutputType>WinExe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>HierarchicalDataBinding</RootNamespace>
<AssemblyName>HierarchicalDataBinding</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<WarningLevel>4</WarningLevel>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
<PlatformTarget>x86</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
<PlatformTarget>x86</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup>
<StartupObject>HierarchicalDataBinding.App</StartupObject>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>AnyCPU</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|AnyCPU'">
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>AnyCPU</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Xaml" />
<Reference Include="System.Xml" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Telerik.Windows.Controls">
<SpecificVersion>False</SpecificVersion>
<HintPath>$(TELERIKWPFDIR)\Binaries\WPF40\Telerik.Windows.Controls.dll</HintPath>
</Reference>
<Reference Include="Telerik.Windows.Controls.Input">
<SpecificVersion>False</SpecificVersion>
<HintPath>$(TELERIKWPFDIR)\Binaries\WPF40\Telerik.Windows.Controls.Input.dll</HintPath>
</Reference>
<Reference Include="Telerik.Windows.Controls.Navigation">
<SpecificVersion>False</SpecificVersion>
<HintPath>$(TELERIKWPFDIR)\Binaries\WPF40\Telerik.Windows.Controls.Navigation.dll</HintPath>
</Reference>
<Reference Include="Telerik.Windows.Data">
<SpecificVersion>False</SpecificVersion>
<HintPath>$(TELERIKWPFDIR)\Binaries\WPF40\Telerik.Windows.Data.dll</HintPath>
</Reference>
<Reference Include="WindowsBase" />
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
</ItemGroup>
<ItemGroup>
<ApplicationDefinition Include="App.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</ApplicationDefinition>
<Page Include="MainWindow.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Compile Include="App.xaml.cs">
<DependentUpon>App.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Compile Include="MainWindow.xaml.cs">
<DependentUpon>MainWindow.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
</ItemGroup>
<ItemGroup>
<Compile Include="Models\ControlItemModel.cs" />
<Compile Include="Models\EditorItemModel.cs" />
<Compile Include="Models\LayoutControlItemModel.cs" />
<Compile Include="Models\NavigationItemModel.cs" />
<Compile Include="MyViewModel.cs" />
<Compile Include="NavigationViewContentTemplateSelector.cs" />
<Compile Include="Properties\AssemblyInfo.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
<None Include="app.config" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<AppDesigner Include="Properties\" />
<None Include="Readme.md" />
</ItemGroup>
<ItemGroup />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
50 changes: 50 additions & 0 deletions NavigationView/HierarchicalDataBinding/MainWindow.xaml
@@ -0,0 +1,50 @@
<Window x:Class="HierarchicalDataBinding.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
xmlns:my="clr-namespace:HierarchicalDataBinding"
Title="MainWindow" Height="600" Width="1200">
<Window.DataContext>
<my:MyViewModel />
</Window.DataContext>
<Grid >
<Grid.Resources>
<telerik:StringToGlyphConverter x:Key="StringToGlyphConverter" />

<my:NavigationViewContentTemplateSelector x:Key="NavigationViewContentTemplateSelector"
EditorsTemplate="{StaticResource EditorsTemplate}"
LayoutControlsTemplate="{StaticResource LayoutControlsTemplate}"
RadComboBoxTemplate="{StaticResource RadComboBoxTemplate}"
RadAutoCompleteBoxTemplate="{StaticResource RadAutoCompleteBoxTemplate}"
RadTileListTemplate="{StaticResource RadTileListTemplate}"
RadTileViewTemplate="{StaticResource RadTileViewTemplate}"/>

<Style x:Key="BaseNavigationViewItemStyle" TargetType="telerik:RadNavigationViewItem">
<Setter Property="DisplayMemberPath" Value="Title" />
<Setter Property="Icon" Value="{Binding IconGlyph}" />
<Setter Property="IconTemplate">
<Setter.Value>
<DataTemplate>
<telerik:RadGlyph Glyph="{Binding Converter={StaticResource StringToGlyphConverter}}" />
</DataTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="ChildNavigationViewItemStyle" TargetType="telerik:RadNavigationViewItem" BasedOn="{StaticResource BaseNavigationViewItemStyle}">
<Setter Property="IconVisibility" Value="Collapsed" />
</Style>
</Grid.Resources>
<telerik:RadNavigationView x:Name="radNavigationView" ItemsSource="{Binding Items}" DisplayMemberPath="Title" SelectedIndex="0">
<telerik:RadNavigationView.ItemContainerStyle>
<Style TargetType="telerik:RadNavigationViewItem" BasedOn="{StaticResource BaseNavigationViewItemStyle}">
<Setter Property="ItemsSource" Value="{Binding Children}" />
<Setter Property="ItemContainerStyle" Value="{StaticResource ChildNavigationViewItemStyle}" />
</Style>
</telerik:RadNavigationView.ItemContainerStyle>

<telerik:RadNavigationView.Content>
<ContentControl Content="{Binding SelectedItem, ElementName=radNavigationView}" ContentTemplateSelector="{StaticResource NavigationViewContentTemplateSelector}" />
</telerik:RadNavigationView.Content>
</telerik:RadNavigationView>
</Grid>
</Window>
12 changes: 12 additions & 0 deletions NavigationView/HierarchicalDataBinding/MainWindow.xaml.cs
@@ -0,0 +1,12 @@
using System.Windows;

namespace HierarchicalDataBinding
{
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}
}
}
@@ -0,0 +1,7 @@
namespace HierarchicalDataBinding.Models
{
public class ControlItemModel : NavigationItemModel
{
public string DocumentationLink { get; set; }
}
}
25 changes: 25 additions & 0 deletions NavigationView/HierarchicalDataBinding/Models/EditorItemModel.cs
@@ -0,0 +1,25 @@
using System.Collections.ObjectModel;

namespace HierarchicalDataBinding.Models
{
public class EditorItemModel : ControlItemModel
{
private ObservableCollection<string> editorItemsSource;

public ObservableCollection<string> EditorItemsSource
{
get
{
if(this.editorItemsSource == null)
{
this.editorItemsSource = new ObservableCollection<string>() { "Germany", "Italy", "France", "Greece", "United States", "United Kingdom", "Bulgaria" };
}

return this.editorItemsSource;
}

}

}

}
@@ -0,0 +1,41 @@
using System.Collections.ObjectModel;

namespace HierarchicalDataBinding.Models
{
public class LayoutControlItemModel : ControlItemModel
{
private ObservableCollection<Customer> layoutControlItems;

public ObservableCollection<Customer> LayoutControlItems
{
get
{
if (this.layoutControlItems == null)
{
this.layoutControlItems = this.GenerateCustomers();
}

return this.layoutControlItems;
}

}

private ObservableCollection<Customer> GenerateCustomers()
{
var customers = new ObservableCollection<Customer>();
for (int i = 1; i <= 5; i++)
{
var customer = new Customer() { Name = "Customer " + i, Age = 25 + i };
customers.Add(customer);
}

return customers;
}
}

public class Customer
{
public string Name { get; set; }
public int Age { get; set; }
}
}

0 comments on commit cd38440

Please sign in to comment.