This commit is contained in:
martinivanoff 2018-02-07 12:11:36 +02:00
Родитель 84359d3234
Коммит 1b6b8def5d
107 изменённых файлов: 3911 добавлений и 60 удалений

Просмотреть файл

@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2013
VisualStudioVersion = 12.0.31101.0
# Visual Studio 14
VisualStudioVersion = 14.0.25420.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AnnotationsAdding", "AnnotationsAdding\AnnotationsAdding.csproj", "{180BF7E5-F209-468F-8BAE-990B02E33D0A}"
EndProject
@ -95,8 +95,9 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OriginValue", "OriginValue\
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AnnotationsProvider", "AnnotationsProvider\AnnotationsProvider.csproj", "{F8B8DC3C-293B-4F4C-922D-A0E39D0C78D9}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DragChartAnnotation", "DragChartAnnotation\DragChartAnnotation.csproj", "{BA2EF516-2018-4873-9959-0F99CFFCB3C0}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
@ -286,8 +287,13 @@ Global
{F8B8DC3C-293B-4F4C-922D-A0E39D0C78D9}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F8B8DC3C-293B-4F4C-922D-A0E39D0C78D9}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F8B8DC3C-293B-4F4C-922D-A0E39D0C78D9}.Release|Any CPU.Build.0 = Release|Any CPU
{BA2EF516-2018-4873-9959-0F99CFFCB3C0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{BA2EF516-2018-4873-9959-0F99CFFCB3C0}.Debug|Any CPU.Build.0 = Debug|Any CPU
{BA2EF516-2018-4873-9959-0F99CFFCB3C0}.Release|Any CPU.ActiveCfg = Release|Any CPU
{BA2EF516-2018-4873-9959-0F99CFFCB3C0}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

Просмотреть файл

@ -0,0 +1,144 @@
using System;
using System.Collections.Generic;
using System.Windows;
using System.Windows.Input;
using Telerik.Charting;
using Telerik.Windows.Controls;
using Telerik.Windows.Controls.ChartView;
namespace DragChartAnnotation
{
public static class AnnotationUtilities
{
private static Dictionary<CartesianChartAnnotation, bool> annotationToIsDragging = new Dictionary<CartesianChartAnnotation, bool>();
public static readonly DependencyProperty IsDraggingEnabledProperty =
DependencyProperty.RegisterAttached(
"IsDraggingEnabled",
typeof(bool),
typeof(AnnotationUtilities),
new PropertyMetadata(false, OnIsDraggingEnabledChanged));
public static bool GetIsDraggingEnabled(DependencyObject obj)
{
return (bool)obj.GetValue(IsDraggingEnabledProperty);
}
public static void SetIsDraggingEnabled(DependencyObject obj, bool value)
{
obj.SetValue(IsDraggingEnabledProperty, value);
}
private static void OnIsDraggingEnabledChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
ManageEventsRegistering((bool)e.NewValue, (CartesianChartAnnotation)d);
}
private static void Annotation_MouseLeave(object sender, System.Windows.Input.MouseEventArgs e)
{
var annotation = (CartesianChartAnnotation)sender;
annotation.Cursor = null;
}
private static void Annotation_MouseEnter(object sender, System.Windows.Input.MouseEventArgs e)
{
var annotation = (CartesianChartAnnotation)sender;
annotation.Cursor = Cursors.Hand;
}
private static void Annotation_MouseLeftButtonDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
{
var annotation = (CartesianChartAnnotation)sender;
annotation.CaptureMouse();
annotationToIsDragging.Add(annotation, true);
}
private static void Annotation_MouseLeftButtonUp(object sender, System.Windows.Input.MouseButtonEventArgs e)
{
var annotation = (CartesianChartAnnotation)sender;
annotation.ReleaseMouseCapture();
annotationToIsDragging.Remove(annotation);
}
private static void Annotation_MouseMove(object sender, System.Windows.Input.MouseEventArgs e)
{
var annotation = (CartesianChartAnnotation)sender;
if (annotationToIsDragging.ContainsKey(annotation))
{
bool isDragging = annotationToIsDragging[annotation];
if (isDragging)
{
var chart = (RadCartesianChart)annotation.Chart;
Point mousePosition = e.GetPosition(chart);
Point coercedPosition = GetCoercedPosition(mousePosition, chart.PlotAreaClip);
DataTuple dataTuple = chart.ConvertPointToData(coercedPosition);
UpdateAnnotationPosition(annotation, dataTuple);
}
}
}
private static void UpdateAnnotationPosition(CartesianChartAnnotation annotation, DataTuple dataTuple)
{
if (annotation is CartesianGridLineAnnotation)
{
UpdateGridLineAnnotation((CartesianGridLineAnnotation)annotation, dataTuple);
}
}
private static void UpdateGridLineAnnotation(CartesianGridLineAnnotation annotation, DataTuple dataTuple)
{
if (annotation.Chart != null)
{
var chart = (RadCartesianChart)annotation.Chart;
if (annotation.Axis == chart.VerticalAxis)
{
annotation.Value = dataTuple.SecondValue;
}
else
{
annotation.Value = dataTuple.FirstValue;
}
}
}
private static Point GetCoercedPosition(Point mousePosition, RadRect plotAreaClip)
{
var x = Math.Max(mousePosition.X, plotAreaClip.X);
x = Math.Min(x, plotAreaClip.Right);
var y = Math.Max(mousePosition.Y, plotAreaClip.Y);
y = Math.Min(y, plotAreaClip.Bottom);
return new Point(x, y);
}
private static void ManageEventsRegistering(bool isDraggingEnabled, CartesianChartAnnotation annotation)
{
UnregisterFromEvents(annotation);
if (isDraggingEnabled)
{
annotation.MouseEnter += Annotation_MouseEnter;
annotation.MouseLeftButtonDown += Annotation_MouseLeftButtonDown;
annotation.MouseMove += Annotation_MouseMove;
annotation.MouseLeftButtonUp += Annotation_MouseLeftButtonUp;
annotation.MouseLeave += Annotation_MouseLeave;
annotation.Unloaded += Annotation_Unloaded;
}
}
private static void Annotation_Unloaded(object sender, RoutedEventArgs e)
{
UnregisterFromEvents((CartesianChartAnnotation)sender);
}
private static void UnregisterFromEvents(CartesianChartAnnotation annotation)
{
annotation.MouseEnter -= Annotation_MouseEnter;
annotation.MouseLeftButtonDown -= Annotation_MouseLeftButtonDown;
annotation.MouseMove -= Annotation_MouseMove;
annotation.MouseLeftButtonUp -= Annotation_MouseLeftButtonUp;
annotation.MouseLeave -= Annotation_MouseLeave;
annotation.Unloaded -= Annotation_Unloaded;
}
}
}

Просмотреть файл

@ -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="DragChartAnnotation.App"
>
<Application.Resources>
</Application.Resources>
</Application>

Просмотреть файл

@ -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 DragChartAnnotation
{
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)
{
}
}
}
}

Просмотреть файл

@ -0,0 +1,127 @@
<?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>{BA2EF516-2018-4873-9959-0F99CFFCB3C0}</ProjectGuid>
<ProjectTypeGuids>{A1591282-1198-4647-A2B1-27E5FF5F6F3B};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>DragChartAnnotation</RootNamespace>
<AssemblyName>DragChartAnnotation</AssemblyName>
<TargetFrameworkIdentifier>Silverlight</TargetFrameworkIdentifier>
<TargetFrameworkVersion>v5.0</TargetFrameworkVersion>
<SilverlightVersion>$(TargetFrameworkVersion)</SilverlightVersion>
<SilverlightApplication>true</SilverlightApplication>
<SupportedCultures>
</SupportedCultures>
<XapOutputs>true</XapOutputs>
<GenerateSilverlightManifest>true</GenerateSilverlightManifest>
<XapFilename>DragChartAnnotation.xap</XapFilename>
<SilverlightManifestTemplate>Properties\AppManifest.xml</SilverlightManifestTemplate>
<SilverlightAppEntry>DragChartAnnotation.App</SilverlightAppEntry>
<TestPageFileName>DragChartAnnotationTestPage.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.Chart">
<HintPath>$(TELERIKSLDIR)\Binaries\Silverlight\Telerik.Windows.Controls.Chart.dll</HintPath>
</Reference>
<Reference Include="Telerik.Windows.Data">
<HintPath>$(TELERIKSLDIR)\Binaries\Silverlight\Telerik.Windows.Data.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="AnnotationUtilities.cs" />
<Compile Include="App.xaml.cs">
<DependentUpon>App.xaml</DependentUpon>
</Compile>
<Compile Include="MainPage.xaml.cs">
<DependentUpon>MainPage.xaml</DependentUpon>
</Compile>
<Compile Include="MainViewModel.cs" />
<Compile Include="PlotInfo.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</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" />
<None Include="Readme.md" />
</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>

Просмотреть файл

@ -0,0 +1,36 @@
<UserControl x:Class="DragChartAnnotation.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
xmlns:local="clr-namespace:DragChartAnnotation"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="400">
<Grid x:Name="LayoutRoot" Background="White">
<telerik:RadCartesianChart>
<telerik:RadCartesianChart.VerticalAxis>
<telerik:LinearAxis x:Name="verticalAxis"/>
</telerik:RadCartesianChart.VerticalAxis>
<telerik:RadCartesianChart.HorizontalAxis>
<telerik:CategoricalAxis />
</telerik:RadCartesianChart.HorizontalAxis>
<telerik:RadCartesianChart.Series>
<telerik:LineSeries ValueBinding="Value"
CategoryBinding="Category"
ItemsSource="{Binding Items}"
Stroke="#FFCE44"
StrokeThickness="3"/>
</telerik:RadCartesianChart.Series>
<telerik:RadCartesianChart.Annotations>
<telerik:CartesianGridLineAnnotation Axis="{Binding ElementName=verticalAxis}"
Value="{Binding LineAnnotationPosition, Mode=TwoWay}"
StrokeThickness="5"
Stroke="#16A05D"
IsHitTestVisible="True"
local:AnnotationUtilities.IsDraggingEnabled="True"/>
</telerik:RadCartesianChart.Annotations>
</telerik:RadCartesianChart>
</Grid>
</UserControl>

Просмотреть файл

@ -0,0 +1,13 @@
using System.Windows.Controls;
namespace DragChartAnnotation
{
public partial class MainPage : UserControl
{
public MainPage()
{
InitializeComponent();
this.DataContext = new MainViewModel();
}
}
}

Просмотреть файл

@ -0,0 +1,41 @@
using System;
using System.Collections.ObjectModel;
using Telerik.Windows.Controls;
namespace DragChartAnnotation
{
public class MainViewModel : ViewModelBase
{
private static Random RandomNumberGenerator = new Random();
private double lineAnnotationPosition;
public ObservableCollection<PlotInfo> Items { get; set; }
public double LineAnnotationPosition
{
get
{
return this.lineAnnotationPosition;
}
set
{
if (this.lineAnnotationPosition != value)
{
this.lineAnnotationPosition = value;
OnPropertyChanged("LineAnnotationPosition");
}
}
}
public MainViewModel()
{
this.Items = new ObservableCollection<PlotInfo>();
for (int i = 0; i < 30; i++)
{
this.Items.Add(new PlotInfo() { Category = "C" + i, Value = RandomNumberGenerator.Next(100, 300) });
}
this.LineAnnotationPosition = this.Items[10].Value;
}
}
}

Просмотреть файл

@ -0,0 +1,8 @@
namespace DragChartAnnotation
{
public class PlotInfo
{
public double Value { get; set; }
public string Category { get; set; }
}
}

Просмотреть файл

@ -0,0 +1,6 @@
<Deployment xmlns="http://schemas.microsoft.com/client/2007/deployment"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
>
<Deployment.Parts>
</Deployment.Parts>
</Deployment>

Просмотреть файл

@ -0,0 +1,35 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("DragChartAnnotation")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("DragChartAnnotation")]
[assembly: AssemblyCopyright("Copyright © 2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("ba2ef516-2018-4873-9959-0f99cffcb3c0")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

Просмотреть файл

@ -0,0 +1,5 @@
## Drag Chart Annotation ##
This example shows how to implement interaction behavior for chart annotation which allows you to drag it. The implementation uses attached behavior and mouse events to enable dragging. You can use the AnnotationUtilities class to add or modify the dragging logic.
<keywords: drag,drop,annotation,mouse>

Просмотреть файл

@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2013
VisualStudioVersion = 12.0.31101.0
# Visual Studio 14
VisualStudioVersion = 14.0.25420.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Introduction", "Introduction\Introduction.csproj", "{EEFB5CE9-E938-45F2-807C-608CB55CE55A}"
EndProject
@ -99,8 +99,9 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AnnotationsProvider", "Anno
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "2.5D_Chart", "2.5D_Chart\2.5D_Chart.csproj", "{7C2B967B-01EA-4E8E-9D7E-58A3240B5CDA}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DragChartAnnotation", "DragChartAnnotation\DragChartAnnotation.csproj", "{85A52E85-EF57-4643-A398-ECF320479DA7}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug.NoXaml|Any CPU = Debug.NoXaml|Any CPU
Debug.NoXaml|Mixed Platforms = Debug.NoXaml|Mixed Platforms
@ -3319,8 +3320,123 @@ Global
{7C2B967B-01EA-4E8E-9D7E-58A3240B5CDA}.ReleaseTrial451|Any CPU.ActiveCfg = Release|Any CPU
{7C2B967B-01EA-4E8E-9D7E-58A3240B5CDA}.ReleaseTrial451|Mixed Platforms.ActiveCfg = Release|Any CPU
{7C2B967B-01EA-4E8E-9D7E-58A3240B5CDA}.ReleaseTrial451|x86.ActiveCfg = Release|Any CPU
{85A52E85-EF57-4643-A398-ECF320479DA7}.Debug.NoXaml|Any CPU.ActiveCfg = Debug|Any CPU
{85A52E85-EF57-4643-A398-ECF320479DA7}.Debug.NoXaml|Any CPU.Build.0 = Debug|Any CPU
{85A52E85-EF57-4643-A398-ECF320479DA7}.Debug.NoXaml|Mixed Platforms.ActiveCfg = Debug|Any CPU
{85A52E85-EF57-4643-A398-ECF320479DA7}.Debug.NoXaml|Mixed Platforms.Build.0 = Debug|Any CPU
{85A52E85-EF57-4643-A398-ECF320479DA7}.Debug.NoXaml|x86.ActiveCfg = Debug|Any CPU
{85A52E85-EF57-4643-A398-ECF320479DA7}.Debug.NoXaml|x86.Build.0 = Debug|Any CPU
{85A52E85-EF57-4643-A398-ECF320479DA7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{85A52E85-EF57-4643-A398-ECF320479DA7}.Debug|Any CPU.Build.0 = Debug|Any CPU
{85A52E85-EF57-4643-A398-ECF320479DA7}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{85A52E85-EF57-4643-A398-ECF320479DA7}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{85A52E85-EF57-4643-A398-ECF320479DA7}.Debug|x86.ActiveCfg = Debug|Any CPU
{85A52E85-EF57-4643-A398-ECF320479DA7}.Debug|x86.Build.0 = Debug|Any CPU
{85A52E85-EF57-4643-A398-ECF320479DA7}.Debug45.NoXaml|Any CPU.ActiveCfg = Debug|Any CPU
{85A52E85-EF57-4643-A398-ECF320479DA7}.Debug45.NoXaml|Any CPU.Build.0 = Debug|Any CPU
{85A52E85-EF57-4643-A398-ECF320479DA7}.Debug45.NoXaml|Mixed Platforms.ActiveCfg = Debug|Any CPU
{85A52E85-EF57-4643-A398-ECF320479DA7}.Debug45.NoXaml|Mixed Platforms.Build.0 = Debug|Any CPU
{85A52E85-EF57-4643-A398-ECF320479DA7}.Debug45.NoXaml|x86.ActiveCfg = Debug|Any CPU
{85A52E85-EF57-4643-A398-ECF320479DA7}.Debug45.NoXaml|x86.Build.0 = Debug|Any CPU
{85A52E85-EF57-4643-A398-ECF320479DA7}.Debug45|Any CPU.ActiveCfg = Debug|Any CPU
{85A52E85-EF57-4643-A398-ECF320479DA7}.Debug45|Any CPU.Build.0 = Debug|Any CPU
{85A52E85-EF57-4643-A398-ECF320479DA7}.Debug45|Mixed Platforms.ActiveCfg = Debug|Any CPU
{85A52E85-EF57-4643-A398-ECF320479DA7}.Debug45|Mixed Platforms.Build.0 = Debug|Any CPU
{85A52E85-EF57-4643-A398-ECF320479DA7}.Debug45|x86.ActiveCfg = Debug|Any CPU
{85A52E85-EF57-4643-A398-ECF320479DA7}.Debug45|x86.Build.0 = Debug|Any CPU
{85A52E85-EF57-4643-A398-ECF320479DA7}.Debug451.NoXaml|Any CPU.ActiveCfg = Debug|Any CPU
{85A52E85-EF57-4643-A398-ECF320479DA7}.Debug451.NoXaml|Any CPU.Build.0 = Debug|Any CPU
{85A52E85-EF57-4643-A398-ECF320479DA7}.Debug451.NoXaml|Mixed Platforms.ActiveCfg = Debug|Any CPU
{85A52E85-EF57-4643-A398-ECF320479DA7}.Debug451.NoXaml|Mixed Platforms.Build.0 = Debug|Any CPU
{85A52E85-EF57-4643-A398-ECF320479DA7}.Debug451.NoXaml|x86.ActiveCfg = Debug|Any CPU
{85A52E85-EF57-4643-A398-ECF320479DA7}.Debug451.NoXaml|x86.Build.0 = Debug|Any CPU
{85A52E85-EF57-4643-A398-ECF320479DA7}.Debug451|Any CPU.ActiveCfg = Debug|Any CPU
{85A52E85-EF57-4643-A398-ECF320479DA7}.Debug451|Any CPU.Build.0 = Debug|Any CPU
{85A52E85-EF57-4643-A398-ECF320479DA7}.Debug451|Mixed Platforms.ActiveCfg = Debug|Any CPU
{85A52E85-EF57-4643-A398-ECF320479DA7}.Debug451|Mixed Platforms.Build.0 = Debug|Any CPU
{85A52E85-EF57-4643-A398-ECF320479DA7}.Debug451|x86.ActiveCfg = Debug|Any CPU
{85A52E85-EF57-4643-A398-ECF320479DA7}.Debug451|x86.Build.0 = Debug|Any CPU
{85A52E85-EF57-4643-A398-ECF320479DA7}.Release.NoXaml|Any CPU.ActiveCfg = Release|Any CPU
{85A52E85-EF57-4643-A398-ECF320479DA7}.Release.NoXaml|Any CPU.Build.0 = Release|Any CPU
{85A52E85-EF57-4643-A398-ECF320479DA7}.Release.NoXaml|Mixed Platforms.ActiveCfg = Release|Any CPU
{85A52E85-EF57-4643-A398-ECF320479DA7}.Release.NoXaml|Mixed Platforms.Build.0 = Release|Any CPU
{85A52E85-EF57-4643-A398-ECF320479DA7}.Release.NoXaml|x86.ActiveCfg = Release|Any CPU
{85A52E85-EF57-4643-A398-ECF320479DA7}.Release.NoXaml|x86.Build.0 = Release|Any CPU
{85A52E85-EF57-4643-A398-ECF320479DA7}.Release|Any CPU.ActiveCfg = Release|Any CPU
{85A52E85-EF57-4643-A398-ECF320479DA7}.Release|Any CPU.Build.0 = Release|Any CPU
{85A52E85-EF57-4643-A398-ECF320479DA7}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{85A52E85-EF57-4643-A398-ECF320479DA7}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{85A52E85-EF57-4643-A398-ECF320479DA7}.Release|x86.ActiveCfg = Release|Any CPU
{85A52E85-EF57-4643-A398-ECF320479DA7}.Release|x86.Build.0 = Release|Any CPU
{85A52E85-EF57-4643-A398-ECF320479DA7}.Release45.NoXaml|Any CPU.ActiveCfg = Release|Any CPU
{85A52E85-EF57-4643-A398-ECF320479DA7}.Release45.NoXaml|Any CPU.Build.0 = Release|Any CPU
{85A52E85-EF57-4643-A398-ECF320479DA7}.Release45.NoXaml|Mixed Platforms.ActiveCfg = Release|Any CPU
{85A52E85-EF57-4643-A398-ECF320479DA7}.Release45.NoXaml|Mixed Platforms.Build.0 = Release|Any CPU
{85A52E85-EF57-4643-A398-ECF320479DA7}.Release45.NoXaml|x86.ActiveCfg = Release|Any CPU
{85A52E85-EF57-4643-A398-ECF320479DA7}.Release45.NoXaml|x86.Build.0 = Release|Any CPU
{85A52E85-EF57-4643-A398-ECF320479DA7}.Release45|Any CPU.ActiveCfg = Release|Any CPU
{85A52E85-EF57-4643-A398-ECF320479DA7}.Release45|Any CPU.Build.0 = Release|Any CPU
{85A52E85-EF57-4643-A398-ECF320479DA7}.Release45|Mixed Platforms.ActiveCfg = Release|Any CPU
{85A52E85-EF57-4643-A398-ECF320479DA7}.Release45|Mixed Platforms.Build.0 = Release|Any CPU
{85A52E85-EF57-4643-A398-ECF320479DA7}.Release45|x86.ActiveCfg = Release|Any CPU
{85A52E85-EF57-4643-A398-ECF320479DA7}.Release45|x86.Build.0 = Release|Any CPU
{85A52E85-EF57-4643-A398-ECF320479DA7}.Release451.NoXaml|Any CPU.ActiveCfg = Release|Any CPU
{85A52E85-EF57-4643-A398-ECF320479DA7}.Release451.NoXaml|Any CPU.Build.0 = Release|Any CPU
{85A52E85-EF57-4643-A398-ECF320479DA7}.Release451.NoXaml|Mixed Platforms.ActiveCfg = Release|Any CPU
{85A52E85-EF57-4643-A398-ECF320479DA7}.Release451.NoXaml|Mixed Platforms.Build.0 = Release|Any CPU
{85A52E85-EF57-4643-A398-ECF320479DA7}.Release451.NoXaml|x86.ActiveCfg = Release|Any CPU
{85A52E85-EF57-4643-A398-ECF320479DA7}.Release451.NoXaml|x86.Build.0 = Release|Any CPU
{85A52E85-EF57-4643-A398-ECF320479DA7}.Release451|Any CPU.ActiveCfg = Release|Any CPU
{85A52E85-EF57-4643-A398-ECF320479DA7}.Release451|Any CPU.Build.0 = Release|Any CPU
{85A52E85-EF57-4643-A398-ECF320479DA7}.Release451|Mixed Platforms.ActiveCfg = Release|Any CPU
{85A52E85-EF57-4643-A398-ECF320479DA7}.Release451|Mixed Platforms.Build.0 = Release|Any CPU
{85A52E85-EF57-4643-A398-ECF320479DA7}.Release451|x86.ActiveCfg = Release|Any CPU
{85A52E85-EF57-4643-A398-ECF320479DA7}.Release451|x86.Build.0 = Release|Any CPU
{85A52E85-EF57-4643-A398-ECF320479DA7}.ReleaseNoCA|Any CPU.ActiveCfg = Release|Any CPU
{85A52E85-EF57-4643-A398-ECF320479DA7}.ReleaseNoCA|Any CPU.Build.0 = Release|Any CPU
{85A52E85-EF57-4643-A398-ECF320479DA7}.ReleaseNoCA|Mixed Platforms.ActiveCfg = Release|Any CPU
{85A52E85-EF57-4643-A398-ECF320479DA7}.ReleaseNoCA|Mixed Platforms.Build.0 = Release|Any CPU
{85A52E85-EF57-4643-A398-ECF320479DA7}.ReleaseNoCA|x86.ActiveCfg = Release|Any CPU
{85A52E85-EF57-4643-A398-ECF320479DA7}.ReleaseNoCA|x86.Build.0 = Release|Any CPU
{85A52E85-EF57-4643-A398-ECF320479DA7}.ReleaseTrial.NoXaml|Any CPU.ActiveCfg = Release|Any CPU
{85A52E85-EF57-4643-A398-ECF320479DA7}.ReleaseTrial.NoXaml|Any CPU.Build.0 = Release|Any CPU
{85A52E85-EF57-4643-A398-ECF320479DA7}.ReleaseTrial.NoXaml|Mixed Platforms.ActiveCfg = Release|Any CPU
{85A52E85-EF57-4643-A398-ECF320479DA7}.ReleaseTrial.NoXaml|Mixed Platforms.Build.0 = Release|Any CPU
{85A52E85-EF57-4643-A398-ECF320479DA7}.ReleaseTrial.NoXaml|x86.ActiveCfg = Release|Any CPU
{85A52E85-EF57-4643-A398-ECF320479DA7}.ReleaseTrial.NoXaml|x86.Build.0 = Release|Any CPU
{85A52E85-EF57-4643-A398-ECF320479DA7}.ReleaseTrial|Any CPU.ActiveCfg = Release|Any CPU
{85A52E85-EF57-4643-A398-ECF320479DA7}.ReleaseTrial|Any CPU.Build.0 = Release|Any CPU
{85A52E85-EF57-4643-A398-ECF320479DA7}.ReleaseTrial|Mixed Platforms.ActiveCfg = Release|Any CPU
{85A52E85-EF57-4643-A398-ECF320479DA7}.ReleaseTrial|Mixed Platforms.Build.0 = Release|Any CPU
{85A52E85-EF57-4643-A398-ECF320479DA7}.ReleaseTrial|x86.ActiveCfg = Release|Any CPU
{85A52E85-EF57-4643-A398-ECF320479DA7}.ReleaseTrial|x86.Build.0 = Release|Any CPU
{85A52E85-EF57-4643-A398-ECF320479DA7}.ReleaseTrial45.NoXaml|Any CPU.ActiveCfg = Release|Any CPU
{85A52E85-EF57-4643-A398-ECF320479DA7}.ReleaseTrial45.NoXaml|Any CPU.Build.0 = Release|Any CPU
{85A52E85-EF57-4643-A398-ECF320479DA7}.ReleaseTrial45.NoXaml|Mixed Platforms.ActiveCfg = Release|Any CPU
{85A52E85-EF57-4643-A398-ECF320479DA7}.ReleaseTrial45.NoXaml|Mixed Platforms.Build.0 = Release|Any CPU
{85A52E85-EF57-4643-A398-ECF320479DA7}.ReleaseTrial45.NoXaml|x86.ActiveCfg = Release|Any CPU
{85A52E85-EF57-4643-A398-ECF320479DA7}.ReleaseTrial45.NoXaml|x86.Build.0 = Release|Any CPU
{85A52E85-EF57-4643-A398-ECF320479DA7}.ReleaseTrial45|Any CPU.ActiveCfg = Release|Any CPU
{85A52E85-EF57-4643-A398-ECF320479DA7}.ReleaseTrial45|Any CPU.Build.0 = Release|Any CPU
{85A52E85-EF57-4643-A398-ECF320479DA7}.ReleaseTrial45|Mixed Platforms.ActiveCfg = Release|Any CPU
{85A52E85-EF57-4643-A398-ECF320479DA7}.ReleaseTrial45|Mixed Platforms.Build.0 = Release|Any CPU
{85A52E85-EF57-4643-A398-ECF320479DA7}.ReleaseTrial45|x86.ActiveCfg = Release|Any CPU
{85A52E85-EF57-4643-A398-ECF320479DA7}.ReleaseTrial45|x86.Build.0 = Release|Any CPU
{85A52E85-EF57-4643-A398-ECF320479DA7}.ReleaseTrial451.NoXaml|Any CPU.ActiveCfg = Release|Any CPU
{85A52E85-EF57-4643-A398-ECF320479DA7}.ReleaseTrial451.NoXaml|Any CPU.Build.0 = Release|Any CPU
{85A52E85-EF57-4643-A398-ECF320479DA7}.ReleaseTrial451.NoXaml|Mixed Platforms.ActiveCfg = Release|Any CPU
{85A52E85-EF57-4643-A398-ECF320479DA7}.ReleaseTrial451.NoXaml|Mixed Platforms.Build.0 = Release|Any CPU
{85A52E85-EF57-4643-A398-ECF320479DA7}.ReleaseTrial451.NoXaml|x86.ActiveCfg = Release|Any CPU
{85A52E85-EF57-4643-A398-ECF320479DA7}.ReleaseTrial451.NoXaml|x86.Build.0 = Release|Any CPU
{85A52E85-EF57-4643-A398-ECF320479DA7}.ReleaseTrial451|Any CPU.ActiveCfg = Release|Any CPU
{85A52E85-EF57-4643-A398-ECF320479DA7}.ReleaseTrial451|Any CPU.Build.0 = Release|Any CPU
{85A52E85-EF57-4643-A398-ECF320479DA7}.ReleaseTrial451|Mixed Platforms.ActiveCfg = Release|Any CPU
{85A52E85-EF57-4643-A398-ECF320479DA7}.ReleaseTrial451|Mixed Platforms.Build.0 = Release|Any CPU
{85A52E85-EF57-4643-A398-ECF320479DA7}.ReleaseTrial451|x86.ActiveCfg = Release|Any CPU
{85A52E85-EF57-4643-A398-ECF320479DA7}.ReleaseTrial451|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

Просмотреть файл

@ -0,0 +1,144 @@
using System;
using System.Collections.Generic;
using System.Windows;
using System.Windows.Input;
using Telerik.Charting;
using Telerik.Windows.Controls;
using Telerik.Windows.Controls.ChartView;
namespace DragChartAnnotation
{
public static class AnnotationUtilities
{
private static Dictionary<CartesianChartAnnotation, bool> annotationToIsDragging = new Dictionary<CartesianChartAnnotation, bool>();
public static readonly DependencyProperty IsDraggingEnabledProperty =
DependencyProperty.RegisterAttached(
"IsDraggingEnabled",
typeof(bool),
typeof(AnnotationUtilities),
new PropertyMetadata(false, OnIsDraggingEnabledChanged));
public static bool GetIsDraggingEnabled(DependencyObject obj)
{
return (bool)obj.GetValue(IsDraggingEnabledProperty);
}
public static void SetIsDraggingEnabled(DependencyObject obj, bool value)
{
obj.SetValue(IsDraggingEnabledProperty, value);
}
private static void OnIsDraggingEnabledChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
ManageEventsRegistering((bool)e.NewValue, (CartesianChartAnnotation)d);
}
private static void Annotation_MouseLeave(object sender, System.Windows.Input.MouseEventArgs e)
{
var annotation = (CartesianChartAnnotation)sender;
annotation.Cursor = null;
}
private static void Annotation_MouseEnter(object sender, System.Windows.Input.MouseEventArgs e)
{
var annotation = (CartesianChartAnnotation)sender;
annotation.Cursor = Cursors.Hand;
}
private static void Annotation_MouseLeftButtonDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
{
var annotation = (CartesianChartAnnotation)sender;
annotation.CaptureMouse();
annotationToIsDragging.Add(annotation, true);
}
private static void Annotation_MouseLeftButtonUp(object sender, System.Windows.Input.MouseButtonEventArgs e)
{
var annotation = (CartesianChartAnnotation)sender;
annotation.ReleaseMouseCapture();
annotationToIsDragging.Remove(annotation);
}
private static void Annotation_MouseMove(object sender, System.Windows.Input.MouseEventArgs e)
{
var annotation = (CartesianChartAnnotation)sender;
if (annotationToIsDragging.ContainsKey(annotation))
{
bool isDragging = annotationToIsDragging[annotation];
if (isDragging)
{
var chart = (RadCartesianChart)annotation.Chart;
Point mousePosition = e.GetPosition(chart);
Point coercedPosition = GetCoercedPosition(mousePosition, chart.PlotAreaClip);
DataTuple dataTuple = chart.ConvertPointToData(coercedPosition);
UpdateAnnotationPosition(annotation, dataTuple);
}
}
}
private static void UpdateAnnotationPosition(CartesianChartAnnotation annotation, DataTuple dataTuple)
{
if (annotation is CartesianGridLineAnnotation)
{
UpdateGridLineAnnotation((CartesianGridLineAnnotation)annotation, dataTuple);
}
}
private static void UpdateGridLineAnnotation(CartesianGridLineAnnotation annotation, DataTuple dataTuple)
{
if (annotation.Chart != null)
{
var chart = (RadCartesianChart)annotation.Chart;
if (annotation.Axis == chart.VerticalAxis)
{
annotation.Value = dataTuple.SecondValue;
}
else
{
annotation.Value = dataTuple.FirstValue;
}
}
}
private static Point GetCoercedPosition(Point mousePosition, RadRect plotAreaClip)
{
var x = Math.Max(mousePosition.X, plotAreaClip.X);
x = Math.Min(x, plotAreaClip.Right);
var y = Math.Max(mousePosition.Y, plotAreaClip.Y);
y = Math.Min(y, plotAreaClip.Bottom);
return new Point(x, y);
}
private static void ManageEventsRegistering(bool isDraggingEnabled, CartesianChartAnnotation annotation)
{
UnregisterFromEvents(annotation);
if (isDraggingEnabled)
{
annotation.MouseEnter += Annotation_MouseEnter;
annotation.MouseLeftButtonDown += Annotation_MouseLeftButtonDown;
annotation.MouseMove += Annotation_MouseMove;
annotation.MouseLeftButtonUp += Annotation_MouseLeftButtonUp;
annotation.MouseLeave += Annotation_MouseLeave;
annotation.Unloaded += Annotation_Unloaded;
}
}
private static void Annotation_Unloaded(object sender, RoutedEventArgs e)
{
UnregisterFromEvents((CartesianChartAnnotation)sender);
}
private static void UnregisterFromEvents(CartesianChartAnnotation annotation)
{
annotation.MouseEnter -= Annotation_MouseEnter;
annotation.MouseLeftButtonDown -= Annotation_MouseLeftButtonDown;
annotation.MouseMove -= Annotation_MouseMove;
annotation.MouseLeftButtonUp -= Annotation_MouseLeftButtonUp;
annotation.MouseLeave -= Annotation_MouseLeave;
annotation.Unloaded -= Annotation_Unloaded;
}
}
}

Просмотреть файл

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
</startup>
</configuration>

Просмотреть файл

@ -0,0 +1,9 @@
<Application x:Class="DragChartAnnotation.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:DragChartAnnotation"
StartupUri="MainWindow.xaml">
<Application.Resources>
</Application.Resources>
</Application>

Просмотреть файл

@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Threading.Tasks;
using System.Windows;
namespace DragChartAnnotation
{
/// <summary>
/// Interaction logic for App.xaml
/// </summary>
public partial class App : Application
{
}
}

Просмотреть файл

@ -0,0 +1,127 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{85A52E85-EF57-4643-A398-ECF320479DA7}</ProjectGuid>
<OutputType>WinExe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>DragChartAnnotation</RootNamespace>
<AssemblyName>DragChartAnnotation</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<WarningLevel>4</WarningLevel>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</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|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xaml">
<RequiredTargetFramework>4.0</RequiredTargetFramework>
</Reference>
<Reference Include="Telerik.Windows.Controls">
<SpecificVersion>False</SpecificVersion>
<HintPath>$(TELERIKWPFDIR)\Binaries\WPF40\Telerik.Windows.Controls.dll</HintPath>
</Reference>
<Reference Include="Telerik.Windows.Controls.Chart">
<SpecificVersion>False</SpecificVersion>
<HintPath>$(TELERIKWPFDIR)\Binaries\WPF40\Telerik.Windows.Controls.Chart.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="AnnotationUtilities.cs" />
<Compile Include="MainViewModel.cs" />
<Compile Include="MainWindow.xaml.cs">
<DependentUpon>MainWindow.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
</ItemGroup>
<ItemGroup>
<Compile Include="PlotInfo.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="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<AppDesigner Include="Properties\" />
<Resource Include="Readme.md" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</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>

Просмотреть файл

@ -0,0 +1,41 @@
using System;
using System.Collections.ObjectModel;
using Telerik.Windows.Controls;
namespace DragChartAnnotation
{
public class MainViewModel : ViewModelBase
{
private static Random RandomNumberGenerator = new Random();
private double lineAnnotationPosition;
public ObservableCollection<PlotInfo> Items { get; set; }
public double LineAnnotationPosition
{
get
{
return this.lineAnnotationPosition;
}
set
{
if (this.lineAnnotationPosition != value)
{
this.lineAnnotationPosition = value;
OnPropertyChanged("LineAnnotationPosition");
}
}
}
public MainViewModel()
{
this.Items = new ObservableCollection<PlotInfo>();
for (int i = 0; i < 30; i++)
{
this.Items.Add(new PlotInfo() { Category = "C" + i, Value = RandomNumberGenerator.Next(100, 300) });
}
this.LineAnnotationPosition = this.Items[10].Value;
}
}
}

Просмотреть файл

@ -0,0 +1,35 @@
<Window x:Class="DragChartAnnotation.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
xmlns:local="clr-namespace:DragChartAnnotation"
mc:Ignorable="d"
Title="MainWindow">
<Grid>
<telerik:RadCartesianChart>
<telerik:RadCartesianChart.VerticalAxis>
<telerik:LinearAxis x:Name="verticalAxis"/>
</telerik:RadCartesianChart.VerticalAxis>
<telerik:RadCartesianChart.HorizontalAxis>
<telerik:CategoricalAxis />
</telerik:RadCartesianChart.HorizontalAxis>
<telerik:RadCartesianChart.Series>
<telerik:LineSeries ValueBinding="Value"
CategoryBinding="Category"
ItemsSource="{Binding Items}"
Stroke="#FFCE44"
StrokeThickness="3"/>
</telerik:RadCartesianChart.Series>
<telerik:RadCartesianChart.Annotations>
<telerik:CartesianGridLineAnnotation Axis="{Binding ElementName=verticalAxis}"
Value="{Binding LineAnnotationPosition, Mode=TwoWay}"
StrokeThickness="5"
Stroke="#16A05D"
IsHitTestVisible="True"
local:AnnotationUtilities.IsDraggingEnabled="True"/>
</telerik:RadCartesianChart.Annotations>
</telerik:RadCartesianChart>
</Grid>
</Window>

Просмотреть файл

@ -0,0 +1,13 @@
using System.Windows;
namespace DragChartAnnotation
{
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
this.DataContext = new MainViewModel();
}
}
}

Просмотреть файл

@ -0,0 +1,8 @@
namespace DragChartAnnotation
{
public class PlotInfo
{
public double Value { get; set; }
public string Category { get; set; }
}
}

Просмотреть файл

@ -0,0 +1,55 @@
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Windows;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("DragChartAnnotation")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("DragChartAnnotation")]
[assembly: AssemblyCopyright("Copyright © 2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
//In order to begin building localizable applications, set
//<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file
//inside a <PropertyGroup>. For example, if you are using US english
//in your source files, set the <UICulture> to en-US. Then uncomment
//the NeutralResourceLanguage attribute below. Update the "en-US" in
//the line below to match the UICulture setting in the project file.
//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
// or application resource dictionaries)
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
)]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

63
ChartView/WPF/DragChartAnnotation/Properties/Resources.Designer.cs сгенерированный Normal file
Просмотреть файл

@ -0,0 +1,63 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace DragChartAnnotation.Properties {
using System;
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
// This class was auto-generated by the StronglyTypedResourceBuilder
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources() {
}
/// <summary>
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("DragChartAnnotation.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
}
}

Просмотреть файл

@ -0,0 +1,117 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

26
ChartView/WPF/DragChartAnnotation/Properties/Settings.Designer.cs сгенерированный Normal file
Просмотреть файл

@ -0,0 +1,26 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace DragChartAnnotation.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "14.0.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default {
get {
return defaultInstance;
}
}
}
}

Просмотреть файл

@ -0,0 +1,7 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="uri:settings" CurrentProfile="(Default)">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
<Settings />
</SettingsFile>

Просмотреть файл

@ -0,0 +1,5 @@
## Drag Chart Annotation ##
This example shows how to implement interaction behavior for chart annotation which allows you to drag it. The implementation uses attached behavior and mouse events to enable dragging. You can use the AnnotationUtilities class to add or modify the dragging logic.
<keywords: drag,drop,annotation,mouse>

Просмотреть файл

@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.24720.0
VisualStudioVersion = 14.0.25420.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DefaultVisualMaterialSelector", "DefaultVisualMaterialSelector\DefaultVisualMaterialSelector.csproj", "{EF6ECB56-6E40-47A1-A3BB-C61D03679F46}"
EndProject
@ -17,6 +17,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ValueGradientColorizer", "V
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DataPointColorizer", "DataPointColorizer\DataPointColorizer.csproj", "{7B1CC216-4821-417A-87D7-B08EB577F2EA}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SurfaceProjection", "SurfaceProjection\SurfaceProjection.csproj", "{C3ED42D2-AB90-41F4-8876-1FFA7039A51A}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -51,6 +53,10 @@ Global
{7B1CC216-4821-417A-87D7-B08EB577F2EA}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7B1CC216-4821-417A-87D7-B08EB577F2EA}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7B1CC216-4821-417A-87D7-B08EB577F2EA}.Release|Any CPU.Build.0 = Release|Any CPU
{C3ED42D2-AB90-41F4-8876-1FFA7039A51A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C3ED42D2-AB90-41F4-8876-1FFA7039A51A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C3ED42D2-AB90-41F4-8876-1FFA7039A51A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C3ED42D2-AB90-41F4-8876-1FFA7039A51A}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

Просмотреть файл

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
</startup>
</configuration>

Просмотреть файл

@ -0,0 +1,9 @@
<Application x:Class="SurfaceProjection.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:SurfaceProjection"
StartupUri="MainWindow.xaml">
<Application.Resources>
</Application.Resources>
</Application>

Просмотреть файл

@ -0,0 +1,8 @@
using System.Windows;
namespace SurfaceProjection
{
public partial class App : Application
{
}
}

Просмотреть файл

@ -0,0 +1,43 @@
using System;
using System.Windows.Media;
using System.Windows.Media.Media3D;
using Telerik.Windows.Controls.ChartView;
namespace SurfaceProjection
{
public class FeedingColorizer : SurfaceSeries3DValueGradientColorizer
{
public PointCollection TextureCoordinates { get; set; }
public Material Material { get; set; }
public event EventHandler OnColorizingCompleted;
public void RaiseColorizingCompleted()
{
if (OnColorizingCompleted != null)
{
OnColorizingCompleted(this, null);
}
}
protected override void OnColorizationFinished()
{
RaiseColorizingCompleted();
base.OnColorizationFinished();
}
public override Material GetMaterial(SurfaceSeries3DColorizerContext context)
{
var material = base.GetMaterial(context);
this.Material = material;
AssignTextureCoordinates(context);
return material;
}
private void AssignTextureCoordinates(SurfaceSeries3DColorizerContext context)
{
this.TextureCoordinates = context.TextureCoordinates;
}
}
}

Просмотреть файл

@ -0,0 +1,66 @@
<Window x:Class="SurfaceProjection.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:SurfaceProjection"
xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
mc:Ignorable="d"
Title="MainWindow" Height="350" Width="525">
<telerik:RadCartesianChart3D x:Name="chart" >
<telerik:RadCartesianChart3D.XAxis>
<telerik:LinearAxis3D Maximum="30"/>
</telerik:RadCartesianChart3D.XAxis>
<telerik:RadCartesianChart3D.YAxis>
<telerik:LinearAxis3D Maximum="30" />
</telerik:RadCartesianChart3D.YAxis>
<telerik:RadCartesianChart3D.ZAxis>
<telerik:LinearAxis3D />
</telerik:RadCartesianChart3D.ZAxis>
<telerik:RadCartesianChart3D.Series>
<telerik:SurfaceSeries3D x:Name="constlevelseries"
XValueBinding="XValue"
YValueBinding="YValue"
ZValueBinding="ConstValue"
ItemsSource="{Binding Points}">
</telerik:SurfaceSeries3D>
<telerik:SurfaceSeries3D x:Name="originalData"
XValueBinding="XValue"
YValueBinding="YValue"
ZValueBinding="ZValue"
ItemsSource="{Binding Points}">
<telerik:SurfaceSeries3D.Colorizer>
<local:FeedingColorizer IsAbsolute="False" x:Name="colorizer">
<local:FeedingColorizer.GradientStops>
<GradientStopCollection>
<GradientStop Color="DarkBlue" Offset="0" />
<GradientStop Color="Blue" Offset="0.125" />
<GradientStop Color="Azure" Offset="0.25" />
<GradientStop Color="Cyan" Offset="0.375" />
<GradientStop Color="LightGreen" Offset="0.50" />
<GradientStop Color="Yellow" Offset="0.625" />
<GradientStop Color="Orange" Offset="0.75" />
<GradientStop Color="Red" Offset="0.875" />
<GradientStop Color="DarkRed" Offset="1.0" />
</GradientStopCollection>
</local:FeedingColorizer.GradientStops>
</local:FeedingColorizer>
</telerik:SurfaceSeries3D.Colorizer>
</telerik:SurfaceSeries3D>
</telerik:RadCartesianChart3D.Series>
<telerik:RadCartesianChart3D.Grid>
<telerik:CartesianChart3DGrid />
</telerik:RadCartesianChart3D.Grid>
<telerik:RadCartesianChart3D.Behaviors>
<telerik:Chart3DCameraBehavior Distance="2700"
FirstAngle="320"
MaxSecondAngle="360"
SecondAngle="70"/>
</telerik:RadCartesianChart3D.Behaviors>
</telerik:RadCartesianChart3D>
</Window>

Просмотреть файл

@ -0,0 +1,25 @@
using System;
using System.Windows;
namespace SurfaceProjection
{
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
this.DataContext = new ViewModel();
this.colorizer.OnColorizingCompleted += ColorizerOnColorizingCompleted;
}
private void ColorizerOnColorizingCompleted(object sender, EventArgs e)
{
ProjectionColorizer customColorizer = new ProjectionColorizer();
customColorizer.CustomMaterial = this.colorizer.Material;
customColorizer.TextureCoordinates = this.colorizer.TextureCoordinates;
this.constlevelseries.Colorizer = customColorizer;
}
}
}

Просмотреть файл

@ -0,0 +1,10 @@
namespace SurfaceProjection
{
public class PlotInfo
{
public string XValue { get; set; }
public string YValue { get; set; }
public double ZValue { get; set; }
public double ConstValue { get; set; }
}
}

Просмотреть файл

@ -0,0 +1,22 @@
using System.Windows.Media;
using System.Windows.Media.Media3D;
using Telerik.Windows.Controls.ChartView;
namespace SurfaceProjection
{
public class ProjectionColorizer : SurfaceSeries3DDataPointColorizer
{
public Material CustomMaterial { get; set; }
public PointCollection TextureCoordinates { get; set; }
public override Material GetMaterial(SurfaceSeries3DColorizerContext context)
{
return this.CustomMaterial;
}
public override PointCollection GetTextureCoordinates(SurfaceSeries3DColorizerContext context)
{
return this.TextureCoordinates;
}
}
}

Просмотреть файл

@ -0,0 +1,55 @@
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Windows;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("SurfaceProjection")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("SurfaceProjection")]
[assembly: AssemblyCopyright("Copyright © 2018")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
//In order to begin building localizable applications, set
//<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file
//inside a <PropertyGroup>. For example, if you are using US english
//in your source files, set the <UICulture> to en-US. Then uncomment
//the NeutralResourceLanguage attribute below. Update the "en-US" in
//the line below to match the UICulture setting in the project file.
//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
// or application resource dictionaries)
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
)]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

63
ChartView3D/WPF/SurfaceProjection/Properties/Resources.Designer.cs сгенерированный Normal file
Просмотреть файл

@ -0,0 +1,63 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace SurfaceProjection.Properties {
using System;
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
// This class was auto-generated by the StronglyTypedResourceBuilder
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources() {
}
/// <summary>
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("SurfaceProjection.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
}
}

Просмотреть файл

@ -0,0 +1,117 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

26
ChartView3D/WPF/SurfaceProjection/Properties/Settings.Designer.cs сгенерированный Normal file
Просмотреть файл

@ -0,0 +1,26 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace SurfaceProjection.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "14.0.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default {
get {
return defaultInstance;
}
}
}
}

Просмотреть файл

@ -0,0 +1,7 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="uri:settings" CurrentProfile="(Default)">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
<Settings />
</SettingsFile>

Просмотреть файл

@ -0,0 +1,128 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{C3ED42D2-AB90-41F4-8876-1FFA7039A51A}</ProjectGuid>
<OutputType>WinExe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>SurfaceProjection</RootNamespace>
<AssemblyName>SurfaceProjection</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<WarningLevel>4</WarningLevel>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</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|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xaml">
<RequiredTargetFramework>4.0</RequiredTargetFramework>
</Reference>
<Reference Include="Telerik.Windows.Controls, Version=2017.3.1018.45, Culture=neutral, PublicKeyToken=5803cfa389c90ce7, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>$(TELERIKWPFDIR)\Binaries\WPF40\Telerik.Windows.Controls.dll</HintPath>
</Reference>
<Reference Include="Telerik.Windows.Controls.Chart, Version=2017.3.1018.45, Culture=neutral, PublicKeyToken=5803cfa389c90ce7, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>$(TELERIKWPFDIR)\Binaries\WPF40\Telerik.Windows.Controls.Chart.dll</HintPath>
</Reference>
<Reference Include="Telerik.Windows.Data, Version=2017.3.1018.45, Culture=neutral, PublicKeyToken=5803cfa389c90ce7, processorArchitecture=MSIL">
<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>
<Compile Include="ViewModel.cs" />
<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="FeedingColorizer.cs" />
<Compile Include="MainWindow.xaml.cs">
<DependentUpon>MainWindow.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
</ItemGroup>
<ItemGroup>
<Compile Include="PlotInfo.cs" />
<Compile Include="ProjectionColorizer.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="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<AppDesigner Include="Properties\" />
<None Include="readme.md" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</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>

Просмотреть файл

@ -0,0 +1,56 @@
using System;
using System.Collections.ObjectModel;
using Telerik.Windows.Controls;
namespace SurfaceProjection
{
public class ViewModel : ViewModelBase
{
private ObservableCollection<PlotInfo> points;
public ObservableCollection<PlotInfo> Points
{
get
{
if(this.points == null)
{
this.points = this.GenerateDataViaFunction();
}
return points;
}
}
private ObservableCollection<PlotInfo> GenerateDataViaFunction()
{
// This function is used to generate the data for the surface
// f(x,y) = z = sin(x * 2 * pi / maxX) * cos(y * 2 * pi / maxY) * 200
// where x e [0; maxX]
// and y e [0; maxY]
ObservableCollection<PlotInfo> data = new ObservableCollection<PlotInfo>();
double maxX = 30;
double maxY = 30;
for (int x = 0; x < maxX; x++)
{
for (int y = 0; y < maxY; y++)
{
double xValue = Math.Sin(x * Math.PI / (0.50 * maxX));
double yValue = Math.Cos(y * Math.PI / (0.50 * maxY));
double z = 200 * xValue * yValue;
PlotInfo pi = new PlotInfo
{
XValue = x.ToString(),
YValue = y.ToString(),
ZValue = z,
ConstValue = 500
};
data.Add(pi);
}
}
return data;
}
}
}

Просмотреть файл

@ -0,0 +1,5 @@
## SurfaceProjection ##
This example demonstrates how to project one surface onto another.
<keywords: colorizer, surfaceseries3d, databinding>

Двоичные данные
MSControls/ThemingExample/Images/bgFluent.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 78 KiB

Двоичные данные
MSControls/ThemingExample/Images/bgFluentDark.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 518 KiB

Просмотреть файл

@ -25,11 +25,13 @@
</Border.Resources>
<ScrollViewer BorderThickness="0" Style="{StaticResource ScrollViewerStyle}">
<StackPanel Margin="11,6,0,8">
<RadioButton x:Name="Material" Checked="Material_Checked" FontFamily="Segoe UI" VerticalContentAlignment="Center" FontSize="14" Margin="0,4" Content="Material" Foreground="#CC000000" IsChecked="True"/>
<RadioButton x:Name="Fluent_Dark" Checked="Fluent_Dark_Checked" FontFamily="Segoe UI" VerticalContentAlignment="Center" FontSize="14" Margin="0,4" Content="Fluent__Dark" Foreground="#CC000000"/>
<RadioButton x:Name="Fluent_Light" Checked="Fluent_Checked" FontFamily="Segoe UI" VerticalContentAlignment="Center" FontSize="14" Margin="0,4" Content="Fluent__Light" Foreground="#CC000000" IsChecked="True"/>
<RadioButton x:Name="Material" Checked="Material_Checked" FontFamily="Segoe UI" VerticalContentAlignment="Center" FontSize="14" Margin="0,4" Content="Material" Foreground="#CC000000" />
<RadioButton x:Name="Office2016Touch" Checked="Office2016Touch_Checked" FontFamily="Segoe UI" VerticalContentAlignment="Center" FontSize="14" Margin="0,4" Content="Office2016Touch" Foreground="#CC000000"/>
<RadioButton x:Name="Office2016" Checked="Office2016_Checked" FontFamily="Segoe UI" VerticalContentAlignment="Center" FontSize="14" Margin="0,4" Content="Office2016" Foreground="#CC000000"/>
<RadioButton x:Name="Green_Light" Checked="Green_Light_Checked" FontFamily="Segoe UI" VerticalContentAlignment="Center" FontSize="14" Margin="0,4" Content="Green_Dark" Foreground="#CC000000"/>
<RadioButton x:Name="Green_Dark" Checked="Green_Dark_Checked" FontFamily="Segoe UI" VerticalContentAlignment="Center" FontSize="14" Margin="0,4" Content="Green_Light" Foreground="#CC000000"/>
<RadioButton x:Name="Green_Light" Checked="Green_Light_Checked" FontFamily="Segoe UI" VerticalContentAlignment="Center" FontSize="14" Margin="0,4" Content="Green__Dark" Foreground="#CC000000"/>
<RadioButton x:Name="Green_Dark" Checked="Green_Dark_Checked" FontFamily="Segoe UI" VerticalContentAlignment="Center" FontSize="14" Margin="0,4" Content="Green__Light" Foreground="#CC000000"/>
<RadioButton x:Name="VisualStudio2013" Checked="VisualStudio2013_Checked" FontFamily="Segoe UI" VerticalContentAlignment="Center" FontSize="14" Margin="0,4" Content="VisualStudio2013" Foreground="#CC000000"/>
<RadioButton x:Name="VisualStudio2013_Dark" Checked="VisualStudio2013_Dark_Checked" FontFamily="Segoe UI" VerticalContentAlignment="Center" FontSize="14" Margin="0,4" Content="VisualStudio2013__Dark" Foreground="#CC000000"/>
<RadioButton x:Name="VisualStudio2013_Blue" Checked="VisualStudio2013_Blue_Checked" FontFamily="Segoe UI" VerticalContentAlignment="Center" FontSize="14" Margin="0,4" Content="VisualStudio2013__Blue" Foreground="#CC000000"/>
@ -119,9 +121,9 @@
<PasswordBox Margin="0,12,0,4" Password="PasswordBox" MinWidth="215" HorizontalAlignment="Left"/>
</StackPanel>
<telerik:Label Margin="-5,8,0,4" Grid.Row="5" FontFamily="Segoe UI" FontSize="14" Content="Buttons"/>
<StackPanel Grid.Row="6" Orientation="Horizontal" Margin="0,0,0,0">
<StackPanel Grid.Row="6" Orientation="Horizontal">
<Button MinWidth="100" Content="Button"/>
<RepeatButton MinWidth="100" Margin="14,0,0,0" HorizontalAlignment="Right" Content="RepeatButton"/>
<RepeatButton MinWidth="100" Margin="14,0,0,0" Content="RepeatButton"/>
</StackPanel>
</Grid>
<Grid Margin="34,22,0,0" Grid.Column="2">

Просмотреть файл

@ -324,6 +324,45 @@ namespace Theming
{
this.container.Background = new SolidColorBrush(Colors.White);
}
}
}
}
private void Fluent_Checked(object sender, RoutedEventArgs e)
{
Application.Current.Resources.MergedDictionaries.Clear();
Application.Current.Resources.MergedDictionaries.Add(new ResourceDictionary()
{
Source = new Uri("/Telerik.Windows.Themes.Fluent;component/Themes/System.Windows.xaml", UriKind.RelativeOrAbsolute)
});
Application.Current.Resources.MergedDictionaries.Add(new ResourceDictionary()
{
Source = new Uri("/Telerik.Windows.Themes.Fluent;component/Themes/Telerik.Windows.Controls.xaml", UriKind.RelativeOrAbsolute)
});
FluentPalette.LoadPreset(FluentPalette.ColorVariation.Light);
if (container != null)
{
ImageBrush ib = new ImageBrush();
ib.ImageSource = new BitmapImage(new Uri("pack://application:,,,/Theming;component/Images/bgFluent.png", UriKind.Absolute));
this.container.Background = ib;
}
}
private void Fluent_Dark_Checked(object sender, RoutedEventArgs e)
{
Application.Current.Resources.MergedDictionaries.Clear();
Application.Current.Resources.MergedDictionaries.Add(new ResourceDictionary()
{
Source = new Uri("/Telerik.Windows.Themes.Fluent;component/Themes/System.Windows.xaml", UriKind.RelativeOrAbsolute)
});
Application.Current.Resources.MergedDictionaries.Add(new ResourceDictionary()
{
Source = new Uri("/Telerik.Windows.Themes.Fluent;component/Themes/Telerik.Windows.Controls.xaml", UriKind.RelativeOrAbsolute)
});
FluentPalette.LoadPreset(FluentPalette.ColorVariation.Dark);
if (container != null)
{
ImageBrush ib = new ImageBrush();
ib.ImageSource = new BitmapImage(new Uri("pack://application:,,,/Theming;component/Images/bgFluentDark.png", UriKind.Absolute));
this.container.Background = ib;
}
}
}
}

Просмотреть файл

@ -103,6 +103,9 @@
<Reference Include="Telerik.Windows.Themes.Material">
<HintPath>$(TELERIKWPFDIR)\Binaries.NoXaml\WPF40\Telerik.Windows.Themes.Material.dll</HintPath>
</Reference>
<Reference Include="Telerik.Windows.Themes.Fluent">
<HintPath>$(TELERIKWPFDIR)\Binaries.NoXaml\WPF40\Telerik.Windows.Themes.Fluent.dll</HintPath>
</Reference>
<Reference Include="WindowsBase" />
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
@ -138,6 +141,12 @@
<ItemGroup>
<Resource Include="Readme.md" />
</ItemGroup>
<ItemGroup>
<Resource Include="Images\bgFluent.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="Images\bgFluentDark.png" />
</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.

Просмотреть файл

@ -77,19 +77,19 @@
<Reference Include="System.Windows.Browser" />
<Reference Include="Telerik.Windows.Controls, Version=2017.3.914.40, Culture=neutral, PublicKeyToken=5803cfa389c90ce7, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>$(TELERIKSLDIR)\Binaries.NoXaml\Silverlight\Telerik.Windows.Controls.dll</HintPath>
<HintPath>$(TELERIKSLDIR)\Binaries\Silverlight\Telerik.Windows.Controls.dll</HintPath>
</Reference>
<Reference Include="Telerik.Windows.Controls.DataVisualization, Version=2017.3.914.40, Culture=neutral, PublicKeyToken=5803cfa389c90ce7, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>$(TELERIKSLDIR)\Binaries.NoXaml\Silverlight\Telerik.Windows.Controls.DataVisualization.dll</HintPath>
<HintPath>$(TELERIKSLDIR)\Binaries\Silverlight\Telerik.Windows.Controls.DataVisualization.dll</HintPath>
</Reference>
<Reference Include="Telerik.Windows.Controls.Input, Version=2017.3.914.40, Culture=neutral, PublicKeyToken=5803cfa389c90ce7, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>$(TELERIKSLDIR)\Binaries.NoXaml\Silverlight\Telerik.Windows.Controls.Input.dll</HintPath>
<HintPath>$(TELERIKSLDIR)\Binaries\Silverlight\Telerik.Windows.Controls.Input.dll</HintPath>
</Reference>
<Reference Include="Telerik.Windows.Themes.Office_Black, Version=2017.3.914.40, Culture=neutral, PublicKeyToken=5803cfa389c90ce7, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>$(TELERIKSLDIR)\Binaries.NoXaml\Silverlight\Telerik.Windows.Themes.Office_Black.dll</HintPath>
<HintPath>$(TELERIKSLDIR)\Binaries\Silverlight\Telerik.Windows.Themes.Office_Black.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>

Просмотреть файл

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
</startup>
</configuration>

Просмотреть файл

@ -0,0 +1,15 @@
<Application x:Class="RemoveOpacityInFluentTheme.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:RemoveOpacityInFluentTheme"
StartupUri="MainWindow.xaml">
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/Telerik.Windows.Themes.Fluent;component/Themes/System.Windows.xaml"/>
<ResourceDictionary Source="/Telerik.Windows.Themes.Fluent;component/Themes/Telerik.Windows.Controls.xaml"/>
<ResourceDictionary Source="/Telerik.Windows.Themes.Fluent;component/Themes/Telerik.Windows.Controls.Input.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
</Application>

Просмотреть файл

@ -0,0 +1,11 @@
using System.Windows;
namespace RemoveOpacityInFluentTheme
{
/// <summary>
/// Interaction logic for App.xaml
/// </summary>
public partial class App : Application
{
}
}

Просмотреть файл

@ -0,0 +1,24 @@
<Window x:Class="RemoveOpacityInFluentTheme.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:RemoveOpacityInFluentTheme"
xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
mc:Ignorable="d"
Title="MainWindow" Height="350" Width="525">
<Window.Resources>
<LinearGradientBrush x:Key="linearBrush" MappingMode="Absolute" SpreadMethod="Repeat" StartPoint="0 0" EndPoint="8 0">
<GradientStop Color="White" Offset="0"/>
<GradientStop Color="White" Offset="0.5" />
<GradientStop Color="#30000000" Offset="0.5" />
<GradientStop Color="#30000000" Offset="1" />
</LinearGradientBrush>
</Window.Resources>
<StackPanel Background="{StaticResource linearBrush}">
<telerik:RadMaskedNumericInput VerticalAlignment="Center" HorizontalAlignment="Center" />
<telerik:RadAutoCompleteBox VerticalAlignment="Center" HorizontalAlignment="Center" Width="150" />
<telerik:RadNumericUpDown />
<telerik:RadButton Content="Make controls opaque" VerticalAlignment="Center" HorizontalAlignment="Center" Click="RadButton_Click" />
</StackPanel>
</Window>

Просмотреть файл

@ -0,0 +1,40 @@
using System.Windows;
using System.Windows.Media;
using Telerik.Windows.Controls;
namespace RemoveOpacityInFluentTheme
{
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}
public static Color RgbFromArgbAndBackgroundColor(Color targetColor, Color backgroundColor)
{
var baseAlpha = targetColor.A / 255.0;
var reverseAlpha = 1.0 - baseAlpha;
byte redValue = (byte)((targetColor.R * baseAlpha) + (backgroundColor.R * reverseAlpha));
byte greenValue = (byte)((targetColor.G * baseAlpha) + (backgroundColor.G * reverseAlpha));
byte blueValue = (byte)((targetColor.B * baseAlpha) + (backgroundColor.B * reverseAlpha));
return Color.FromArgb(255, redValue, greenValue, blueValue);
}
private void RadButton_Click(object sender, RoutedEventArgs e)
{
Color mainColor = FluentPalette.Palette.MainColor;
Color primaryColor = FluentPalette.Palette.PrimaryColor;
Color mouseOverColor = FluentPalette.Palette.MouseOverColor;
Color basicColor = FluentPalette.Palette.BasicColor;
Color pressedColor = FluentPalette.Palette.PressedColor;
FluentPalette.Palette.MainColor = RgbFromArgbAndBackgroundColor(mainColor, FluentPalette.Palette.PrimaryBackgroundColor);
FluentPalette.Palette.PrimaryColor = RgbFromArgbAndBackgroundColor(primaryColor, FluentPalette.Palette.PrimaryBackgroundColor);
FluentPalette.Palette.MouseOverColor = RgbFromArgbAndBackgroundColor(mouseOverColor, FluentPalette.Palette.PrimaryBackgroundColor);
FluentPalette.Palette.BasicColor = RgbFromArgbAndBackgroundColor(basicColor, FluentPalette.Palette.PrimaryBackgroundColor);
FluentPalette.Palette.PressedColor = RgbFromArgbAndBackgroundColor(pressedColor, FluentPalette.Palette.PrimaryBackgroundColor);
}
}
}

Просмотреть файл

@ -0,0 +1,55 @@
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Windows;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("RemoveOpacityInFluentTheme")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("RemoveOpacityInFluentTheme")]
[assembly: AssemblyCopyright("Copyright © 2018")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
//In order to begin building localizable applications, set
//<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file
//inside a <PropertyGroup>. For example, if you are using US english
//in your source files, set the <UICulture> to en-US. Then uncomment
//the NeutralResourceLanguage attribute below. Update the "en-US" in
//the line below to match the UICulture setting in the project file.
//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
// or application resource dictionaries)
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
)]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

63
Theming/RemoveOpacityInFluentTheme/Properties/Resources.Designer.cs сгенерированный Normal file
Просмотреть файл

@ -0,0 +1,63 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace RemoveOpacityInFluentTheme.Properties {
using System;
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
// This class was auto-generated by the StronglyTypedResourceBuilder
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources() {
}
/// <summary>
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("RemoveOpacityInFluentTheme.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
}
}

Просмотреть файл

@ -0,0 +1,117 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

26
Theming/RemoveOpacityInFluentTheme/Properties/Settings.Designer.cs сгенерированный Normal file
Просмотреть файл

@ -0,0 +1,26 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace RemoveOpacityInFluentTheme.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "14.0.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default {
get {
return defaultInstance;
}
}
}
}

Просмотреть файл

@ -0,0 +1,7 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="uri:settings" CurrentProfile="(Default)">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
<Settings />
</SettingsFile>

Просмотреть файл

@ -0,0 +1,118 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{E458D860-C5CD-49C3-882B-B9CC4F189FCA}</ProjectGuid>
<OutputType>WinExe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>RemoveOpacityInFluentTheme</RootNamespace>
<AssemblyName>RemoveOpacityInFluentTheme</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<WarningLevel>4</WarningLevel>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</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|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Xaml">
<RequiredTargetFramework>4.0</RequiredTargetFramework>
</Reference>
<Reference Include="Telerik.Windows.Controls, Version=2018.1.130.40, Culture=neutral, PublicKeyToken=5803cfa389c90ce7, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>$(TELERIKWPFDIR)\Binaries.NoXaml\WPF40\Telerik.Windows.Controls.dll</HintPath>
</Reference>
<Reference Include="Telerik.Windows.Controls.Input, Version=2018.1.130.40, Culture=neutral, PublicKeyToken=5803cfa389c90ce7, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>$(TELERIKWPFDIR)\Binaries.NoXaml\WPF40\Telerik.Windows.Controls.Input.dll</HintPath>
</Reference>
<Reference Include="Telerik.Windows.Themes.Fluent">
<HintPath>$(TELERIKWPFDIR)\Binaries.NoXaml\WPF40\Telerik.Windows.Themes.Fluent.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="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="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<AppDesigner Include="Properties\" />
<None Include="readme.md" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</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>

Просмотреть файл

@ -0,0 +1,4 @@
##Remove opacity in Fluent theme##
This example demonstrates how to remove the opacity of the Fluent theme brushes in order to make the controls opaque.
<keywords:opacity, fluent>

22
Theming/Theming_WPF.sln Normal file
Просмотреть файл

@ -0,0 +1,22 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.25420.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RemoveOpacityInFluentTheme", "RemoveOpacityInFluentTheme\RemoveOpacityInFluentTheme.csproj", "{E458D860-C5CD-49C3-882B-B9CC4F189FCA}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{E458D860-C5CD-49C3-882B-B9CC4F189FCA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E458D860-C5CD-49C3-882B-B9CC4F189FCA}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E458D860-C5CD-49C3-882B-B9CC4F189FCA}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E458D860-C5CD-49C3-882B-B9CC4F189FCA}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

Просмотреть файл

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
</startup>
</configuration>

Просмотреть файл

@ -0,0 +1,9 @@
<Application x:Class="TransitionBetweenPhotos.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:TransitionBetweenPhotos"
StartupUri="MainWindow.xaml">
<Application.Resources>
</Application.Resources>
</Application>

Просмотреть файл

@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Threading.Tasks;
using System.Windows;
namespace TransitionBetweenPhotos
{
/// <summary>
/// Interaction logic for App.xaml
/// </summary>
public partial class App : Application
{
}
}

Просмотреть файл

@ -0,0 +1,7 @@
<Application xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Class="DataBinding.App">
<Application.Resources>
</Application.Resources>
</Application>

Просмотреть файл

@ -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 DataBinding
{
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)
{
}
}
}
}

Просмотреть файл

@ -0,0 +1,133 @@
<?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>{258CB517-631F-4393-959F-F539BE52DC0F}</ProjectGuid>
<ProjectTypeGuids>{A1591282-1198-4647-A2B1-27E5FF5F6F3B};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>DataBinding</RootNamespace>
<AssemblyName>DataBinding</AssemblyName>
<TargetFrameworkIdentifier>Silverlight</TargetFrameworkIdentifier>
<TargetFrameworkVersion>v5.0</TargetFrameworkVersion>
<SilverlightVersion>$(TargetFrameworkVersion)</SilverlightVersion>
<SilverlightApplication>true</SilverlightApplication>
<SupportedCultures>
</SupportedCultures>
<XapOutputs>true</XapOutputs>
<GenerateSilverlightManifest>true</GenerateSilverlightManifest>
<XapFilename>TransitionBetweenPhotos_SL.xap</XapFilename>
<SilverlightManifestTemplate>Properties\AppManifest.xml</SilverlightManifestTemplate>
<SilverlightAppEntry>DataBinding.App</SilverlightAppEntry>
<TestPageFileName>TransitionBetweenPhotos_SLTestPage.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>
</ItemGroup>
<ItemGroup>
<Compile Include="App_SL.xaml.cs">
<DependentUpon>App_SL.xaml</DependentUpon>
</Compile>
<Compile Include="Example.xaml.cs">
<DependentUpon>Example.xaml</DependentUpon>
</Compile>
<Compile Include="MainPage.xaml.cs">
<DependentUpon>MainPage.xaml</DependentUpon>
</Compile>
<Compile Include="Photo.cs" />
<Compile Include="ViewModel.cs" />
</ItemGroup>
<ItemGroup>
<Page Include="App_SL.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Example.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="MainPage.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
</ItemGroup>
<ItemGroup>
<None Include="Properties\AppManifest.xml" />
<None Include="Readme.md" />
</ItemGroup>
<ItemGroup>
<Resource Include="images\Image1.png" />
<Resource Include="images\Image2.png" />
<Resource Include="images\Image3.png" />
<Resource Include="images\Image4.png" />
<Resource Include="images\Image5.png" />
</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>

Просмотреть файл

@ -0,0 +1,132 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{1D75DC33-386D-4DA5-A6A9-DBD4046E1C4C}</ProjectGuid>
<OutputType>WinExe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>DataBinding</RootNamespace>
<AssemblyName>DataBinding</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<WarningLevel>4</WarningLevel>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</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|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xaml">
<RequiredTargetFramework>4.0</RequiredTargetFramework>
</Reference>
<Reference Include="Telerik.Windows.Controls">
<SpecificVersion>False</SpecificVersion>
<HintPath>$(TELERIKWPFDIR)\Binaries\WPF40\Telerik.Windows.Controls.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>
<Compile Include="Example.xaml.cs">
<DependentUpon>Example.xaml</DependentUpon>
</Compile>
<Compile Include="Photo.cs" />
<Compile Include="ViewModel.cs" />
<Page Include="Example.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<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="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="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<AppDesigner Include="Properties\" />
<None Include="Readme.md" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<ItemGroup>
<Resource Include="images\Image1.png" />
<Resource Include="images\Image2.png" />
<Resource Include="images\Image3.png" />
<Resource Include="images\Image4.png" />
<Resource Include="images\Image5.png" />
</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>

Просмотреть файл

@ -0,0 +1,30 @@
<UserControl x:Class="DataBinding.Example"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="300">
<Grid x:Name="LayoutRoot">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<ListBox x:Name="PhotosListBox"
DisplayMemberPath="Name"
SelectedIndex="0"
ItemsSource="{Binding Photos}" />
<telerik:RadTransitionControl Grid.Column="1"
Content="{Binding SelectedItem, ElementName=PhotosListBox}">
<telerik:RadTransitionControl.ContentTemplate>
<DataTemplate>
<Image Source="{Binding ImageUrl}"
Stretch="Uniform"
Width="100"
Height="100" />
</DataTemplate>
</telerik:RadTransitionControl.ContentTemplate>
</telerik:RadTransitionControl>
</Grid>
</UserControl>

Просмотреть файл

@ -0,0 +1,29 @@
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;
namespace DataBinding
{
/// <summary>
/// Interaction logic for Example.xaml
/// </summary>
public partial class Example : UserControl
{
public Example()
{
InitializeComponent();
this.DataContext = new ViewModel();
}
}
}

Просмотреть файл

@ -0,0 +1,11 @@
<UserControl x:Class="DataBinding.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:DataBinding"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="400">
<local:Example />
</UserControl>

Просмотреть файл

@ -0,0 +1,22 @@
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 DataBinding
{
public partial class MainPage : UserControl
{
public MainPage()
{
InitializeComponent();
}
}
}

Просмотреть файл

@ -0,0 +1,11 @@
<Window x:Class="DataBinding.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:DataBinding"
mc:Ignorable="d"
Title="MainWindow" Height="350" Width="525">
<local:Example />
</Window>

Просмотреть файл

@ -0,0 +1,12 @@
using System.Windows;
namespace DataBinding
{
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}
}
}

Просмотреть файл

@ -0,0 +1,9 @@
namespace DataBinding
{
public class Photo
{
public string Name { get; set; }
public string ImageUrl { get; set; }
}
}

Просмотреть файл

@ -0,0 +1,6 @@
<Deployment xmlns="http://schemas.microsoft.com/client/2007/deployment"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
>
<Deployment.Parts>
</Deployment.Parts>
</Deployment>

Просмотреть файл

@ -0,0 +1,55 @@
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Windows;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("TransitionBetweenPhotos")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("TransitionBetweenPhotos")]
[assembly: AssemblyCopyright("Copyright © 2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
//In order to begin building localizable applications, set
//<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file
//inside a <PropertyGroup>. For example, if you are using US english
//in your source files, set the <UICulture> to en-US. Then uncomment
//the NeutralResourceLanguage attribute below. Update the "en-US" in
//the line below to match the UICulture setting in the project file.
//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
// or application resource dictionaries)
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
)]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

63
TransitionControl/DataBinding/Properties/Resources.Designer.cs сгенерированный Normal file
Просмотреть файл

@ -0,0 +1,63 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace DataBinding.Properties {
using System;
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
// This class was auto-generated by the StronglyTypedResourceBuilder
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources() {
}
/// <summary>
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("DataBinding.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
}
}

Просмотреть файл

@ -0,0 +1,117 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

26
TransitionControl/DataBinding/Properties/Settings.Designer.cs сгенерированный Normal file
Просмотреть файл

@ -0,0 +1,26 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace DataBinding.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "14.0.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default {
get {
return defaultInstance;
}
}
}
}

Просмотреть файл

@ -0,0 +1,7 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="uri:settings" CurrentProfile="(Default)">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
<Settings />
</SettingsFile>

Просмотреть файл

@ -0,0 +1,4 @@
## DataBinding ##
This example demonstrates how to use RadTransitionControl in a data binding scenario.
<keywords: mvvm>

Просмотреть файл

@ -0,0 +1,21 @@
using System.Collections.ObjectModel;
namespace DataBinding
{
public class ViewModel
{
public ObservableCollection<Photo> Photos { get; set; }
public ViewModel()
{
this.Photos = new ObservableCollection<Photo>();
var names = new string[] { "John", "Sarah", "Ivan", "Mark", "Anthony" };
for (int i = 1; i <= 5; i++)
{
string directory = string.Format("../../images/image{0}.png", i);
this.Photos.Add(new Photo() { Name = names[i - 1], ImageUrl = directory });
}
}
}
}

Двоичные данные
TransitionControl/DataBinding/images/Image1.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 7.9 KiB

Двоичные данные
TransitionControl/DataBinding/images/Image2.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 8.6 KiB

Двоичные данные
TransitionControl/DataBinding/images/Image3.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 10 KiB

Двоичные данные
TransitionControl/DataBinding/images/Image4.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 8.2 KiB

Двоичные данные
TransitionControl/DataBinding/images/Image5.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 9.1 KiB

Просмотреть файл

@ -1,10 +1,13 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2012
# Visual Studio 14
VisualStudioVersion = 14.0.25420.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TransitionWithoutBindings_SL", "TransitionWithoutBindings\TransitionWithoutBindings_SL.csproj", "{2298AFDD-0542-4F3C-88AA-EE9C354A565B}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DataBinding_SL", "DataBinding\DataBinding_SL.csproj", "{258CB517-631F-4393-959F-F539BE52DC0F}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
@ -14,8 +17,13 @@ Global
{2298AFDD-0542-4F3C-88AA-EE9C354A565B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2298AFDD-0542-4F3C-88AA-EE9C354A565B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2298AFDD-0542-4F3C-88AA-EE9C354A565B}.Release|Any CPU.Build.0 = Release|Any CPU
{258CB517-631F-4393-959F-F539BE52DC0F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{258CB517-631F-4393-959F-F539BE52DC0F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{258CB517-631F-4393-959F-F539BE52DC0F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{258CB517-631F-4393-959F-F539BE52DC0F}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

Просмотреть файл

@ -1,10 +1,13 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2012
# Visual Studio 14
VisualStudioVersion = 14.0.25420.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TransitionWithoutBindings_WPF", "TransitionWithoutBindings\TransitionWithoutBindings_WPF.csproj", "{D209A0B1-F75D-4ED6-9603-75DF887A73B6}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DataBinding_WPF", "DataBinding\DataBinding_WPF.csproj", "{1D75DC33-386D-4DA5-A6A9-DBD4046E1C4C}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
@ -14,8 +17,13 @@ Global
{D209A0B1-F75D-4ED6-9603-75DF887A73B6}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D209A0B1-F75D-4ED6-9603-75DF887A73B6}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D209A0B1-F75D-4ED6-9603-75DF887A73B6}.Release|Any CPU.Build.0 = Release|Any CPU
{1D75DC33-386D-4DA5-A6A9-DBD4046E1C4C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1D75DC33-386D-4DA5-A6A9-DBD4046E1C4C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1D75DC33-386D-4DA5-A6A9-DBD4046E1C4C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1D75DC33-386D-4DA5-A6A9-DBD4046E1C4C}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

Просмотреть файл

@ -13,17 +13,23 @@ namespace BindToSelfReferencingData.Converters
// We are binding an item
DataItem item = value as DataItem;
if (item != null)
{
return item.Owner.Where(i => i.ParentId == item.Id);
{
var children = item.OwnerCollection.Where(i => i.ParentId == item.Id);
var collection = new DataItemCollection(children);
collection.SetAssociatedItem(item);
return collection;
}
// We are binding the treeview
DataItemCollection items = value as DataItemCollection;
if (items != null)
{
return items.Where(i => i.ParentId == 0);
var children = items.Where(i => i.ParentId == 0);
return new DataItemCollection(children);
}
return null;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();

Просмотреть файл

@ -3,16 +3,14 @@ using System.Windows;
namespace BindToSelfReferencingData
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
this.DataContext = new DataItemCollection()
{
var source = new DataItemCollection()
{
new DataItem () { Text = "Item 1", Id = 1, ParentId = 0 },
new DataItem () { Text = "Item 2", Id = 2, ParentId = 0 },
new DataItem () { Text = "Item 3", Id = 3, ParentId = 0 },
@ -24,8 +22,15 @@ namespace BindToSelfReferencingData
new DataItem () { Text = "Item 2.3", Id = 10, ParentId = 2 },
new DataItem () { Text = "Item 3.1", Id = 11, ParentId = 3 },
new DataItem () { Text = "Item 3.2", Id = 12, ParentId = 3 },
new DataItem () { Text = "Item 3.3", Id = 13, ParentId = 3 }
new DataItem () { Text = "Item 3.3", Id = 13, ParentId = 3, }
};
foreach (var item in source)
{
item.SetOwnerCollection(source);
}
this.DataContext = source;
}
}
}

Просмотреть файл

@ -1,6 +1,8 @@
namespace BindToSelfReferencingData.Models
using Telerik.Windows.Controls;
namespace BindToSelfReferencingData.Models
{
public class DataItem
public class DataItem : ViewModelBase
{
public int Id
{
@ -17,14 +19,16 @@
get;
set;
}
public DataItemCollection Owner
public DataItemCollection OwnerCollection
{
get;
protected set;
}
internal void SetOwner(DataItemCollection collection)
internal void SetOwnerCollection(DataItemCollection collection)
{
this.Owner = collection;
this.OwnerCollection = collection;
}
}
}

Просмотреть файл

@ -1,39 +1,45 @@
using System.Collections.ObjectModel;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Collections.Specialized;
namespace BindToSelfReferencingData.Models
{
public class DataItemCollection : ObservableCollection<DataItem>
{
protected override void InsertItem(int index, DataItem item)
{
this.AdoptItem(item);
base.InsertItem(index, item);
}
protected override void RemoveItem(int index)
public DataItemCollection()
: base()
{
this.DiscardItem(this[index]);
base.RemoveItem(index);
}
protected override void SetItem(int index, DataItem item)
public DataItemCollection(IEnumerable<DataItem> collection)
: base(collection)
{
this.AdoptItem(item);
base.SetItem(index, item);
}
protected override void ClearItems()
public DataItem AssociatedItem
{
foreach (DataItem item in this)
get;
protected set;
}
public void SetAssociatedItem(DataItem item)
{
this.AssociatedItem = item;
}
protected override void OnCollectionChanged(NotifyCollectionChangedEventArgs e)
{
base.OnCollectionChanged(e);
if (e.Action == NotifyCollectionChangedAction.Add)
{
this.DiscardItem(item);
foreach (DataItem item in e.NewItems)
{
if (this.AssociatedItem != null && item.ParentId != this.AssociatedItem.Id)
{
item.ParentId = this.AssociatedItem.Id;
}
}
}
base.ClearItems();
}
private void AdoptItem(DataItem item)
{
item.SetOwner(this);
}
private void DiscardItem(DataItem item)
{
item.SetOwner(null);
}
}
}

Просмотреть файл

@ -0,0 +1,8 @@
<Application x:Class="MVVM_VirtualGrid.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
StartupUri="MainWindow.xaml">
<Application.Resources>
</Application.Resources>
</Application>

Просмотреть файл

@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Windows;
namespace MVVM_VirtualGrid
{
/// <summary>
/// Interaction logic for App.xaml
/// </summary>
public partial class App : Application
{
}
}

126
VirtualGrid/MVVM/Club.cs Normal file
Просмотреть файл

@ -0,0 +1,126 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Linq;
using System.Text;
namespace MVVM_VirtualGrid
{
public class Club : INotifyPropertyChanged
{
public event PropertyChangedEventHandler PropertyChanged;
private string name;
private DateTime established;
private int stadiumCapacity;
private int primaryKey;
public int PrimaryKey
{
get { return this.primaryKey; }
set
{
this.primaryKey = value;
this.OnPropertyChanged("PrimaryKey");
}
}
public string Name
{
get { return this.name; }
set
{
if (value != this.name)
{
this.name = value;
this.OnPropertyChanged("Name");
}
}
}
public DateTime Established
{
get { return this.established; }
set
{
if (value != this.established)
{
this.established = value;
this.OnPropertyChanged("Established");
}
}
}
public int StadiumCapacity
{
get { return this.stadiumCapacity; }
set
{
if (value != this.stadiumCapacity)
{
this.stadiumCapacity = value;
this.OnPropertyChanged("StadiumCapacity");
}
}
}
public Club()
{
}
public Club(string name, DateTime established, int stadiumCapacity)
{
this.name = name;
this.established = established;
this.stadiumCapacity = stadiumCapacity;
}
protected virtual void OnPropertyChanged(PropertyChangedEventArgs args)
{
PropertyChangedEventHandler handler = this.PropertyChanged;
if (handler != null)
{
handler(this, args);
}
}
private void OnPropertyChanged(string propertyName)
{
this.OnPropertyChanged(new PropertyChangedEventArgs(propertyName));
}
public override string ToString()
{
return this.Name;
}
public static ObservableCollection<Club> GetClubs()
{
ObservableCollection<Club> clubs = new ObservableCollection<Club>();
Club club;
int id = 0;
// Liverpool
club = new Club("Liverpool", new DateTime(1892, 1, 1), 45362) { PrimaryKey = id};
clubs.Add(club);
id++;
// Manchester Utd.
club = new Club("Manchester Utd.", new DateTime(1878, 1, 1), 76212) {PrimaryKey = id};
clubs.Add(club);
id++;
// Chelsea
club = new Club("Chelsea", new DateTime(1905, 1, 1), 42055) { PrimaryKey = id };
clubs.Add(club);
id++;
// Arsenal
club = new Club("Arsenal", new DateTime(1886, 1, 1), 60355) { PrimaryKey = id };
clubs.Add(club);
return clubs;
}
}
}

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше