Skip to content

Commit

Permalink
Examples update
Browse files Browse the repository at this point in the history
  • Loading branch information
martinivanoff committed Apr 3, 2018
1 parent 489e6e7 commit 72db932
Show file tree
Hide file tree
Showing 39 changed files with 1,689 additions and 10 deletions.
7 changes: 6 additions & 1 deletion Theming/FluentAccentColors/AccentColorSet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,12 @@ public static ThemeVariation Variation
{
return ThemeVariation.Light;
}
return (ThemeVariation)reg.GetValue("AppsUseLightTheme");
var regValue = reg.GetValue("AppsUseLightTheme");
if (regValue != null)
{
return (ThemeVariation)regValue;
}
return ThemeVariation.Light;
}
}

Expand Down
3 changes: 2 additions & 1 deletion Theming/FluentAccentColors/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
xmlns:local="clr-namespace:FluentAccentColors"
mc:Ignorable="d"
Title="MainWindow" Height="350" Width="525">
Title="MainWindow" Height="350" Width="525"
Background="{telerik:FluentResource ResourceKey=PrimaryBackgroundBrush}">
<StackPanel Orientation="Vertical"
Margin="60 60 0 0"
VerticalAlignment="Top" HorizontalAlignment="Left">
Expand Down
2 changes: 1 addition & 1 deletion Theming/FluentAccentColors/Readme.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
##Fluent Accent Colors##
This example demonstrates how to get the current system accent color and use it as the accent color for the Fluent theme.
The solution provided is made only for Windows 10. For more information about application compatibility modes please visit:
The solution provided is made only for versions following Windows 10 Creators Update. For more information about application compatibility modes please visit:
https://docs.telerik.com/devtools/wpf/styling-and-appearance/themes-suite/common-styling-appearance-fluent-theme#acrylic-effect

<KeyWords: fluent, accent, color, windows, noxaml>
8 changes: 8 additions & 0 deletions Timeline/SL/DragDrop/App.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<Application xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Class="DragDrop.App"
>
<Application.Resources>

</Application.Resources>
</Application>
68 changes: 68 additions & 0 deletions Timeline/SL/DragDrop/App.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

namespace DragDrop
{
public partial class App : Application
{

public App()
{
this.Startup += this.Application_Startup;
this.Exit += this.Application_Exit;
this.UnhandledException += this.Application_UnhandledException;

InitializeComponent();
}

private void Application_Startup(object sender, StartupEventArgs e)
{
this.RootVisual = new MainPage();
}

private void Application_Exit(object sender, EventArgs e)
{

}

private void Application_UnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e)
{
// If the app is running outside of the debugger then report the exception using
// the browser's exception mechanism. On IE this will display it a yellow alert
// icon in the status bar and Firefox will display a script error.
if (!System.Diagnostics.Debugger.IsAttached)
{

// NOTE: This will allow the application to continue running after an exception has been thrown
// but not handled.
// For production applications this error handling should be replaced with something that will
// report the error to the website and stop the application.
e.Handled = true;
Deployment.Current.Dispatcher.BeginInvoke(delegate { ReportErrorToDOM(e); });
}
}

private void ReportErrorToDOM(ApplicationUnhandledExceptionEventArgs e)
{
try
{
string errorMsg = e.ExceptionObject.Message + e.ExceptionObject.StackTrace;
errorMsg = errorMsg.Replace('"', '\'').Replace("\r\n", @"\n");

System.Windows.Browser.HtmlPage.Window.Eval("throw new Error(\"Unhandled Error in Silverlight Application " + errorMsg + "\");");
}
catch (Exception)
{
}
}
}
}
131 changes: 131 additions & 0 deletions Timeline/SL/DragDrop/DragDrop.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>8.0.50727</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{018CA352-5AE4-4048-948B-373E91A383ED}</ProjectGuid>
<ProjectTypeGuids>{A1591282-1198-4647-A2B1-27E5FF5F6F3B};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>DragDrop</RootNamespace>
<AssemblyName>DragDrop</AssemblyName>
<TargetFrameworkIdentifier>Silverlight</TargetFrameworkIdentifier>
<TargetFrameworkVersion>v5.0</TargetFrameworkVersion>
<SilverlightVersion>$(TargetFrameworkVersion)</SilverlightVersion>
<SilverlightApplication>true</SilverlightApplication>
<SupportedCultures>
</SupportedCultures>
<XapOutputs>true</XapOutputs>
<GenerateSilverlightManifest>true</GenerateSilverlightManifest>
<XapFilename>DragDrop.xap</XapFilename>
<SilverlightManifestTemplate>Properties\AppManifest.xml</SilverlightManifestTemplate>
<SilverlightAppEntry>DragDrop.App</SilverlightAppEntry>
<TestPageFileName>DragDropTestPage.html</TestPageFileName>
<CreateTestPage>true</CreateTestPage>
<ValidateXaml>true</ValidateXaml>
<EnableOutOfBrowser>false</EnableOutOfBrowser>
<OutOfBrowserSettingsFile>Properties\OutOfBrowserSettings.xml</OutOfBrowserSettingsFile>
<UsePlatformExtensions>false</UsePlatformExtensions>
<ThrowErrorsInValidation>true</ThrowErrorsInValidation>
<LinkedServerProject>
</LinkedServerProject>




</PropertyGroup>
<!-- This property group is only here to support building this project using the
MSBuild 3.5 toolset. In order to work correctly with this older toolset, it needs
to set the TargetFrameworkVersion to v3.5 -->
<PropertyGroup Condition="'$(MSBuildToolsVersion)' == '3.5'">
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>Bin\Debug</OutputPath>
<DefineConstants>DEBUG;TRACE;SILVERLIGHT</DefineConstants>
<NoStdLib>true</NoStdLib>
<NoConfig>true</NoConfig>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>Bin\Release</OutputPath>
<DefineConstants>TRACE;SILVERLIGHT</DefineConstants>
<NoStdLib>true</NoStdLib>
<NoConfig>true</NoConfig>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="mscorlib" />
<Reference Include="System.Windows" />
<Reference Include="system" />
<Reference Include="System.Core">
<HintPath>$(TargetFrameworkDirectory)System.Core.dll</HintPath>
</Reference>
<Reference Include="System.Net" />
<Reference Include="System.Xml" />
<Reference Include="System.Windows.Browser" />
<Reference Include="Telerik.Windows.Controls">
<HintPath>$(TELERIKSLDIR)\Binaries\Silverlight\Telerik.Windows.Controls.dll</HintPath>
</Reference>
<Reference Include="Telerik.Windows.Controls.DataVisualization">
<HintPath>$(TELERIKSLDIR)\Binaries\Silverlight\Telerik.Windows.Controls.DataVisualization.dll</HintPath>
</Reference>
<Reference Include="Telerik.Windows.Data">
<HintPath>$(TELERIKSLDIR)\Binaries\Silverlight\Telerik.Windows.Data.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="App.xaml.cs">
<DependentUpon>App.xaml</DependentUpon>
</Compile>
<Compile Include="DragDrop\CustomRowIndexGenerator.cs" />
<Compile Include="DragDrop\GroupInfo.cs" />
<Compile Include="DragDrop\ITimelineItem.cs" />
<Compile Include="DragDrop\TimelineDragDropBehavior.cs" />
<Compile Include="DragDrop\TimelineItemDragVisualInfo.cs" />
<Compile Include="MainPage.xaml.cs">
<DependentUpon>MainPage.xaml</DependentUpon>
</Compile>
<Compile Include="Models\DataItem.cs" />
<Compile Include="Models\MainViewModel.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<None Include="Readme.md" />
</ItemGroup>
<ItemGroup>
<ApplicationDefinition Include="App.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</ApplicationDefinition>
<Page Include="MainPage.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
</ItemGroup>
<ItemGroup>
<None Include="Properties\AppManifest.xml" />
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\Silverlight\$(SilverlightVersion)\Microsoft.Silverlight.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>
-->
<ProjectExtensions>
<VisualStudio>
<FlavorProperties GUID="{A1591282-1198-4647-A2B1-27E5FF5F6F3B}">
<SilverlightProjectProperties />
</FlavorProperties>
</VisualStudio>
</ProjectExtensions>
</Project>
23 changes: 23 additions & 0 deletions Timeline/SL/DragDrop/DragDrop/CustomRowIndexGenerator.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
using System.Collections.Generic;
using Telerik.Windows.Controls.Timeline;

namespace DragDrop
{
/// <summary>
/// The purpose of this generator is only to allow setting the RowIndex of the timeline items via the model.
/// </summary>
public class CustomRowIndexGenerator : IItemRowIndexGenerator
{
public void GenerateRowIndexes(List<TimelineRowItem> dataItems)
{
foreach (TimelineRowItem item in dataItems)
{
var dataItem = (ITimelineItem)item.DataItem;
if (dataItem.RowIndex > -1)
{
item.RowIndex = dataItem.RowIndex;
}
}
}
}
}
15 changes: 15 additions & 0 deletions Timeline/SL/DragDrop/DragDrop/GroupInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
using System.Windows;

namespace DragDrop
{
/// <summary>
/// This class serves as a container for information about the timeline groups.
/// It is used by the drag drop behavior to store the bounds and row count of the group.
/// </summary>
public class GroupInfo
{
public int RowsCount;
public object Key;
public Rect Bounds;
}
}
15 changes: 15 additions & 0 deletions Timeline/SL/DragDrop/DragDrop/ITimelineItem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
using System;

namespace DragDrop
{
/// <summary>
/// This interface should be implemented by the model used to populate the ItemsSource of the timeline control.
/// It is used in the drag drop behavior.
/// </summary>
public interface ITimelineItem
{
DateTime StartDate { get; set; }
object GroupKey { get; set; }
int RowIndex { get; set; }
}
}
Loading

0 comments on commit 72db932

Please sign in to comment.