├── MainKey.snk
├── TestApplication.WinRT
├── Assets
│ ├── Logo.png
│ ├── DarkGray.png
│ ├── LightGray.png
│ ├── SmallLogo.png
│ ├── StoreLogo.png
│ ├── MediumGray.png
│ └── SplashScreen.png
├── Common
│ ├── BooleanNegationConverter.cs
│ ├── ReadMe.txt
│ ├── BooleanToVisibilityConverter.cs
│ └── BindableBase.cs
├── GroupDetailPage.xaml
├── TestClass.cs
├── App.xaml
├── Properties
│ └── AssemblyInfo.cs
├── GroupDetailPage.xaml.cs
├── Package.appxmanifest
└── App.xaml.cs
├── TestApplication.Shared
├── Shared
│ ├── Fonts
│ │ └── seguisym.ttf
│ └── Images
│ │ └── torsten.png
├── ViewModel
│ └── TestClass.cs
├── Properties
│ └── AssemblyInfo.cs
├── Controls
│ ├── StringToDataTemplateConverter.cs
│ ├── StringToBrushConverter.cs
│ ├── PortableHyperlinkButton.cs
│ └── BooleanToVisibilityConverter.cs
└── TestApplication.Shared.csproj
├── TestApplicationSL
├── app.config
├── Properties
│ ├── AppManifest.xml
│ └── AssemblyInfo.cs
├── App.xaml
├── MainPage.xaml
├── MainPage.xaml.cs
├── TestClass.cs
├── App.xaml.cs
└── TestApplicationSL.csproj
├── TestApplicationWPF
├── App.config
├── Properties
│ ├── Settings.settings
│ ├── Settings.Designer.cs
│ ├── AssemblyInfo.cs
│ ├── Resources.Designer.cs
│ └── Resources.resx
├── App.xaml.cs
├── App.xaml
├── MainWindow.xaml
└── MainWindow.xaml.cs
├── De.TorstenMandelkow.MetroChart
├── Core
│ ├── Extensions.cs
│ ├── Doughnut
│ │ └── DoughnutChart.cs
│ ├── ChartSeriesViewModel.cs
│ ├── GaugeChart
│ │ └── RadialGaugeChart.cs
│ ├── BarChart
│ │ ├── StackedBar100Chart.cs
│ │ ├── StackedBarChart.cs
│ │ ├── ClusteredBarChart.cs
│ │ └── BarPiece.cs
│ ├── ColumnChart
│ │ ├── StackedColumn100Chart.cs
│ │ ├── StackedColumnChart.cs
│ │ ├── ClusteredColumnChart.cs
│ │ └── ColumnPiece.cs
│ ├── PieChart
│ │ └── PieChart.cs
│ ├── DataPointGroup.cs
│ └── PieceBase.cs
├── ChartControls
│ ├── ResourceDictionaryCollection.cs
│ ├── ChartTitle.cs
│ ├── Legend.cs
│ ├── ChartLegendItem.cs
│ ├── PiePieceLabel.cs
│ ├── ChartSeries.cs
│ ├── PlotterArea.cs
│ └── ChartArea.cs
├── Properties
│ └── AssemblyInfo.cs
├── Controls
│ ├── RowSeriesPanel.cs
│ ├── StackedColumnsPanel.cs
│ ├── FadingListView.cs
│ ├── EvenlyDistributedColumnsGrid.cs
│ ├── EvenlyDistributedRowGrid.cs
│ ├── CustomWrapPanel.cs
│ └── MinimalWidthTextBlock.cs
├── Converters
│ ├── DoubleToGridLengthPercent.cs
│ └── BooleanToVisibilityConverter.cs
└── De.TorstenMandelkow.MetroChart.csproj
├── TestApplicationSL.Web
├── Web.config
├── Web.Debug.config
├── Web.Release.config
├── Properties
│ └── AssemblyInfo.cs
├── TestApplicationSLTestPage.html
├── TestApplicationSLTestPage.aspx
├── TestApplicationSL.Web.csproj
└── Silverlight.js
├── README.md
├── De.TorstenMandelkow.MetroChart.WinRT
└── Properties
│ └── AssemblyInfo.cs
├── De.TorstenMandelkow.MetroChart.SL
└── Properties
│ └── AssemblyInfo.cs
├── De.TorstenMandelkow.MetroChart.WPF
└── Properties
│ └── AssemblyInfo.cs
├── LICENSE
├── .gitignore
└── XAMLReplace.targets
/MainKey.snk:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/azeier/De.TorstenMandelkow.MetroChart/HEAD/MainKey.snk
--------------------------------------------------------------------------------
/TestApplication.WinRT/Assets/Logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/azeier/De.TorstenMandelkow.MetroChart/HEAD/TestApplication.WinRT/Assets/Logo.png
--------------------------------------------------------------------------------
/TestApplication.WinRT/Assets/DarkGray.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/azeier/De.TorstenMandelkow.MetroChart/HEAD/TestApplication.WinRT/Assets/DarkGray.png
--------------------------------------------------------------------------------
/TestApplication.WinRT/Assets/LightGray.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/azeier/De.TorstenMandelkow.MetroChart/HEAD/TestApplication.WinRT/Assets/LightGray.png
--------------------------------------------------------------------------------
/TestApplication.WinRT/Assets/SmallLogo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/azeier/De.TorstenMandelkow.MetroChart/HEAD/TestApplication.WinRT/Assets/SmallLogo.png
--------------------------------------------------------------------------------
/TestApplication.WinRT/Assets/StoreLogo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/azeier/De.TorstenMandelkow.MetroChart/HEAD/TestApplication.WinRT/Assets/StoreLogo.png
--------------------------------------------------------------------------------
/TestApplication.WinRT/Assets/MediumGray.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/azeier/De.TorstenMandelkow.MetroChart/HEAD/TestApplication.WinRT/Assets/MediumGray.png
--------------------------------------------------------------------------------
/TestApplication.WinRT/Assets/SplashScreen.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/azeier/De.TorstenMandelkow.MetroChart/HEAD/TestApplication.WinRT/Assets/SplashScreen.png
--------------------------------------------------------------------------------
/TestApplication.Shared/Shared/Fonts/seguisym.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/azeier/De.TorstenMandelkow.MetroChart/HEAD/TestApplication.Shared/Shared/Fonts/seguisym.ttf
--------------------------------------------------------------------------------
/TestApplication.Shared/Shared/Images/torsten.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/azeier/De.TorstenMandelkow.MetroChart/HEAD/TestApplication.Shared/Shared/Images/torsten.png
--------------------------------------------------------------------------------
/TestApplicationSL/app.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/TestApplicationWPF/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/TestApplicationWPF/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/TestApplicationSL/Properties/AppManifest.xml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/TestApplicationWPF/App.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Configuration;
4 | using System.Data;
5 | using System.Linq;
6 | using System.Threading.Tasks;
7 | using System.Windows;
8 |
9 | namespace TestApplicationWPF
10 | {
11 | ///
12 | /// Interaktionslogik für "App.xaml"
13 | ///
14 | public partial class App : Application
15 | {
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/TestApplicationSL/App.xaml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/De.TorstenMandelkow.MetroChart/Core/Extensions.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Net;
3 | using System.Windows;
4 | using System.Reflection;
5 | using System.Linq;
6 |
7 | namespace De.TorstenMandelkow.MetroChart
8 | {
9 | public static class Extensions
10 | {
11 | public static PropertyInfo[] GetAllProperties(this Type type)
12 | {
13 | #if NETFX_CORE
14 | return type.GetRuntimeProperties().ToArray();
15 | #else
16 | #if SILVERLIGHT
17 | return type.GetProperties();
18 | #else
19 | return type.GetProperties();
20 | #endif
21 | #endif
22 | }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/TestApplicationWPF/App.xaml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/TestApplicationSL/MainPage.xaml:
--------------------------------------------------------------------------------
1 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/TestApplicationSL/MainPage.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Collections.ObjectModel;
4 | using System.Linq;
5 | using System.Net;
6 | using System.Windows;
7 | using System.Windows.Controls;
8 | using System.Windows.Documents;
9 | using System.Windows.Input;
10 | using System.Windows.Media;
11 | using System.Windows.Media.Animation;
12 | using System.Windows.Shapes;
13 | using TestApplication;
14 |
15 | namespace TestApplicationSL
16 | {
17 | public partial class MainPage : UserControl
18 | {
19 | public MainPage()
20 | {
21 | InitializeComponent();
22 |
23 | this.DataContext = new TestApplication.Shared.TestPageViewModel();
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/TestApplication.WinRT/Common/BooleanNegationConverter.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using Windows.UI.Xaml.Data;
3 |
4 | namespace TestApplication.WinRT.Common
5 | {
6 | ///
7 | /// Value converter that translates true to false and vice versa.
8 | ///
9 | public sealed class BooleanNegationConverter : IValueConverter
10 | {
11 | public object Convert(object value, Type targetType, object parameter, string language)
12 | {
13 | return !(value is bool && (bool)value);
14 | }
15 |
16 | public object ConvertBack(object value, Type targetType, object parameter, string language)
17 | {
18 | return !(value is bool && (bool)value);
19 | }
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/TestApplicationWPF/MainWindow.xaml:
--------------------------------------------------------------------------------
1 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/TestApplicationSL/TestClass.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Linq;
5 | using System.Text;
6 |
7 | namespace TestApplication
8 | {
9 | public class TestClass : INotifyPropertyChanged
10 | {
11 | public string Category { get; set; }
12 |
13 | private int _number = 0;
14 | public int Number
15 | {
16 | get
17 | {
18 | return _number;
19 | }
20 | set
21 | {
22 | _number = value;
23 | if (PropertyChanged != null)
24 | {
25 | this.PropertyChanged(this, new PropertyChangedEventArgs("Number"));
26 | }
27 | }
28 |
29 | }
30 |
31 | public event PropertyChangedEventHandler PropertyChanged;
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/TestApplicationSL.Web/Web.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/TestApplication.WinRT/GroupDetailPage.xaml:
--------------------------------------------------------------------------------
1 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/De.TorstenMandelkow.MetroChart/ChartControls/ResourceDictionaryCollection.cs:
--------------------------------------------------------------------------------
1 | namespace De.TorstenMandelkow.MetroChart
2 | {
3 | using System;
4 | using System.Collections.Generic;
5 | using System.Collections.ObjectModel;
6 | using System.Linq;
7 | using System.Text;
8 |
9 | #if NETFX_CORE
10 | using Windows.UI.Xaml.Controls;
11 | using Windows.UI.Xaml.Media;
12 | using Windows.UI.Xaml.Shapes;
13 | using Windows.UI.Xaml.Markup;
14 | using Windows.UI.Xaml;
15 | using Windows.Foundation;
16 | using Windows.UI;
17 | using Windows.UI.Core;
18 | #else
19 | using System.Windows.Controls;
20 | using System.Windows;
21 | using System.Windows.Data;
22 | #endif
23 |
24 | public class ResourceDictionaryCollection : ObservableCollection
25 | {
26 | public ResourceDictionaryCollection()
27 | {
28 |
29 | }
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/TestApplication.WinRT/TestClass.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 |
8 | namespace TestApplication.WinRT
9 | {
10 | public class TestClass : INotifyPropertyChanged
11 | {
12 | public string Category { get; set; }
13 |
14 | private double _number = 0;
15 | public double Number
16 | {
17 | get
18 | {
19 | return _number;
20 | }
21 | set
22 | {
23 | _number = value;
24 | if (PropertyChanged != null)
25 | {
26 | this.PropertyChanged(this, new PropertyChangedEventArgs("Number"));
27 | }
28 | }
29 |
30 | }
31 |
32 | public event PropertyChangedEventHandler PropertyChanged;
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/TestApplication.WinRT/Common/ReadMe.txt:
--------------------------------------------------------------------------------
1 | The Common directory contains classes and XAML styles that simplify application development.
2 |
3 | These are not merely convenient, but are required by most Visual Studio project and item templates.
4 | If you need a variation on one of the styles in StandardStyles it is recommended that you make a
5 | copy in your own resource dictionary. When right-clicking on a styled control in the design
6 | surface the context menu includes an option to Edit a Copy to simplify this process.
7 |
8 | Classes in the Common directory form part of your project and may be further enhanced to meet your
9 | needs. Care should be taken when altering existing methods and properties as incompatible changes
10 | will require corresponding changes to code included in a variety of Visual Studio templates. For
11 | example, additional pages added to your project are written assuming that the original methods and
12 | properties in Common classes are still present and that the names of the types have not changed.
--------------------------------------------------------------------------------
/De.TorstenMandelkow.MetroChart/Core/Doughnut/DoughnutChart.cs:
--------------------------------------------------------------------------------
1 | namespace De.TorstenMandelkow.MetroChart
2 | {
3 | using System;
4 | using System.Collections.Generic;
5 | using System.Collections.Specialized;
6 | using System.Linq;
7 | using System.Text;
8 | using System.Windows;
9 |
10 | #if NETFX_CORE
11 | using Windows.UI.Xaml.Controls;
12 | using Windows.UI.Xaml.Media;
13 | using Windows.UI.Xaml.Shapes;
14 | using Windows.UI.Xaml.Markup;
15 | using Windows.UI.Xaml;
16 | using Windows.Foundation;
17 | using Windows.UI;
18 | using Windows.UI.Xaml.Media.Animation;
19 | using Windows.UI.Core;
20 | #else
21 | using System.Windows.Media;
22 | using System.Windows.Controls;
23 | using System.Windows.Data;
24 | #endif
25 |
26 | public class DoughnutChart : PieChart
27 | {
28 | protected override double GridLinesMaxValue
29 | {
30 | get
31 | {
32 | return 0.0;
33 | }
34 | }
35 | }
36 | }
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | Clone of "Modern UI (Metro) Charts for Windows 8, WPF, Silverlight": http://modernuicharts.codeplex.com/
2 |
3 | ###Relevant changes:
4 | * `ChartSeries` now has a `BrushMember` property, allowing the chart piece color to be set via data member rather than palette.
5 |
6 | ####Usage:
7 | Instead of [setting a custom palette](http://modernuicharts.codeplex.com/wikipage?title=Custom%20Color%20Palette) via the `Palette` property add a `Brush` member to the datapoint class used in the chart.
8 | ```C#
9 | public class TestClass
10 | {
11 | public string Category { get; set; }
12 | public int Number { get; set; }
13 | public Brush Brush { get; set; } // <--
14 | }
15 | ```
16 | Then add that member to the ChartSeries xaml
17 | ```XAML
18 |
24 | ```
25 | See [Original documentation](http://modernuicharts.codeplex.com/documentation) for reference.
26 |
--------------------------------------------------------------------------------
/TestApplication.WinRT/App.xaml:
--------------------------------------------------------------------------------
1 |
7 |
8 |
9 |
10 |
11 |
12 |
16 |
17 |
18 |
19 |
20 |
21 | TestApplication.WinRT
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/TestApplication.WinRT/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // Allgemeine Informationen über eine Assembly werden über die folgenden
6 | // Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern,
7 | // die einer Assembly zugeordnet sind.
8 | [assembly: AssemblyTitle("TestApplication.WinRT")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("TestApplication.WinRT")]
13 | [assembly: AssemblyCopyright("Copyright © 2012")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten:
18 | //
19 | // Hauptversion
20 | // Nebenversion
21 | // Buildnummer
22 | // Revision
23 | //
24 | // Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern
25 | // übernehmen, indem Sie '*' eingeben:
26 | // [Assembly: AssemblyVersion("1.0.*")]
27 | [assembly: AssemblyVersion("1.0.0.0")]
28 | [assembly: AssemblyFileVersion("1.0.0.0")]
29 | [assembly: ComVisible(false)]
--------------------------------------------------------------------------------
/TestApplicationWPF/Properties/Settings.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.17626
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace TestApplicationWPF.Properties
12 | {
13 |
14 |
15 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
16 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
17 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
18 | {
19 |
20 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
21 |
22 | public static Settings Default
23 | {
24 | get
25 | {
26 | return defaultInstance;
27 | }
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/TestApplication.WinRT/Common/BooleanToVisibilityConverter.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Linq;
5 | using System.Runtime.CompilerServices;
6 | using Windows.Foundation;
7 | using Windows.Foundation.Collections;
8 | using Windows.Graphics.Display;
9 | using Windows.UI.ViewManagement;
10 | using Windows.UI.Xaml;
11 | using Windows.UI.Xaml.Controls;
12 | using Windows.UI.Xaml.Data;
13 |
14 | namespace TestApplication.WinRT.Common
15 | {
16 | ///
17 | /// Value converter that translates true to and false to
18 | /// .
19 | ///
20 | public sealed class BooleanToVisibilityConverter : IValueConverter
21 | {
22 | public object Convert(object value, Type targetType, object parameter, string language)
23 | {
24 | return (value is bool && (bool)value) ? Visibility.Visible : Visibility.Collapsed;
25 | }
26 |
27 | public object ConvertBack(object value, Type targetType, object parameter, string language)
28 | {
29 | return value is Visibility && (Visibility)value == Visibility.Visible;
30 | }
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/TestApplication.Shared/ViewModel/TestClass.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Collections.ObjectModel;
4 | using System.ComponentModel;
5 | using System.Linq;
6 | using System.Text;
7 | using System.Threading.Tasks;
8 |
9 | namespace TestApplication.Shared
10 | {
11 | public class SeriesData
12 | {
13 | public string SeriesDisplayName { get; set; }
14 |
15 | public string SeriesDescription { get; set; }
16 |
17 | public ObservableCollection Items { get; set; }
18 | }
19 |
20 | public class TestClass : INotifyPropertyChanged
21 | {
22 | public string Category { get; set; }
23 |
24 | private float _number = 0;
25 | public float Number
26 | {
27 | get
28 | {
29 | return _number;
30 | }
31 | set
32 | {
33 | _number = value;
34 | if (PropertyChanged != null)
35 | {
36 | this.PropertyChanged(this, new PropertyChangedEventArgs("Number"));
37 | }
38 | }
39 |
40 | }
41 |
42 | public event PropertyChangedEventHandler PropertyChanged;
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/De.TorstenMandelkow.MetroChart.WinRT/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // Allgemeine Informationen über eine Assembly werden über die folgenden
6 | // Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern,
7 | // die einer Assembly zugeordnet sind.
8 | [assembly: AssemblyTitle("De.TorstenMandelkow.MetroChart.WinRT")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("De.TorstenMandelkow.MetroChart.WinRT")]
13 | [assembly: AssemblyCopyright("Copyright © 2012")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten:
18 | //
19 | // Hauptversion
20 | // Nebenversion
21 | // Buildnummer
22 | // Revision
23 | //
24 | // Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern
25 | // übernehmen, indem Sie '*' eingeben:
26 | // [Assembly: AssemblyVersion("1.0.*")]
27 | [assembly: AssemblyVersion("1.0.0.0")]
28 | [assembly: AssemblyFileVersion("1.0.0.0")]
29 | [assembly: ComVisible(false)]
--------------------------------------------------------------------------------
/TestApplication.WinRT/GroupDetailPage.xaml.cs:
--------------------------------------------------------------------------------
1 | using TestApplication.WinRT.Data;
2 |
3 | using System;
4 | using System.Collections.Generic;
5 | using System.IO;
6 | using System.Linq;
7 | using Windows.Foundation;
8 | using Windows.Foundation.Collections;
9 | using Windows.UI.Xaml;
10 | using Windows.UI.Xaml.Controls;
11 | using Windows.UI.Xaml.Controls.Primitives;
12 | using Windows.UI.Xaml.Data;
13 | using Windows.UI.Xaml.Input;
14 | using Windows.UI.Xaml.Media;
15 | using Windows.UI.Xaml.Navigation;
16 | using System.Collections.ObjectModel;
17 | using System.ComponentModel;
18 |
19 | // Die Elementvorlage für die Seite "Gruppendetails" ist unter http://go.microsoft.com/fwlink/?LinkId=234229 dokumentiert.
20 |
21 | namespace TestApplication.WinRT
22 | {
23 | ///
24 | /// Eine Seite, auf der eine Übersicht über eine einzelne Gruppe einschließlich einer Vorschau der Elemente
25 | /// in der Gruppe angezeigt wird.
26 | ///
27 | public sealed partial class GroupDetailPage : TestApplication.WinRT.Common.LayoutAwarePage
28 | {
29 | public GroupDetailPage()
30 | {
31 |
32 | this.InitializeComponent();
33 |
34 | this.DataContext = new TestApplication.Shared.TestPageViewModel();
35 | }
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/TestApplicationWPF/MainWindow.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Collections.ObjectModel;
4 | using System.ComponentModel;
5 | using System.Linq;
6 | using System.Text;
7 | using System.Threading.Tasks;
8 | using System.Windows;
9 | using System.Windows.Controls;
10 | using System.Windows.Data;
11 | using System.Windows.Documents;
12 | using System.Windows.Input;
13 | using System.Windows.Media;
14 | using System.Windows.Media.Imaging;
15 | using System.Windows.Navigation;
16 | using System.Windows.Shapes;
17 | using TestApplication;
18 |
19 | namespace TestApplicationWPF
20 | {
21 | ///
22 | /// Interaktionslogik für MainWindow.xaml
23 | ///
24 | public partial class MainWindow : Window
25 | {
26 | public MainWindow()
27 | {
28 | InitializeComponent();
29 |
30 | this.DataContext = new TestApplication.Shared.TestPageViewModel();
31 | }
32 |
33 | private void ShellView_Loaded_1(object sender, RoutedEventArgs e)
34 | {
35 | Matrix m = PresentationSource.FromVisual(Application.Current.MainWindow).CompositionTarget.TransformToDevice;
36 | double dx = m.M11;
37 | double dy = m.M22;
38 |
39 | ScaleTransform s = (ScaleTransform)mainGrid.LayoutTransform;
40 | s.ScaleX = 1 / dx;
41 | s.ScaleY = 1 / dy;
42 | }
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/TestApplicationSL.Web/Web.Debug.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
17 |
18 |
31 |
32 |
--------------------------------------------------------------------------------
/TestApplication.WinRT/Package.appxmanifest:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
7 |
8 |
9 | TestApplication.WinRT
10 | tmandel
11 | Assets\StoreLogo.png
12 |
13 |
14 |
15 | 6.2.0
16 | 6.2.0
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
27 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
--------------------------------------------------------------------------------
/TestApplicationSL.Web/Web.Release.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
17 |
18 |
19 |
32 |
33 |
--------------------------------------------------------------------------------
/TestApplicationSL.Web/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("TestApplicationSL.Web")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("TestApplicationSL.Web")]
13 | [assembly: AssemblyCopyright("Copyright © 2012")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 |
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM
23 | [assembly: Guid("7feea000-168c-464b-ad89-b9d321a2168e")]
24 |
25 | // Version information for an assembly consists of the following four values:
26 | //
27 | // Major Version
28 | // Minor Version
29 | // Build Number
30 | // Revision
31 | //
32 | // You can specify all the values or you can default the Revision and Build Numbers
33 | // by using the '*' as shown below:
34 | [assembly: AssemblyVersion("1.0.0.0")]
35 | [assembly: AssemblyFileVersion("1.0.0.0")]
36 |
--------------------------------------------------------------------------------
/De.TorstenMandelkow.MetroChart/Core/ChartSeriesViewModel.cs:
--------------------------------------------------------------------------------
1 | namespace De.TorstenMandelkow.MetroChart
2 | {
3 | using System;
4 | using System.Collections.Generic;
5 | using System.Linq;
6 | using System.Text;
7 |
8 | #if NETFX_CORE
9 |
10 | using Windows.UI.Xaml.Media;
11 | using Windows.UI.Xaml;
12 |
13 | #else
14 |
15 | using System.Windows.Media;
16 | using System.Windows;
17 |
18 | #endif
19 |
20 | ///
21 | /// we cannot use the ChartSeries directly because we will join the data to internal Chartseries
22 | ///
23 | public class ChartLegendItemViewModel : DependencyObject
24 | {
25 | public static readonly DependencyProperty CaptionProperty =
26 | DependencyProperty.Register("Caption",
27 | typeof(string),
28 | typeof(ChartLegendItemViewModel),
29 | new PropertyMetadata(null));
30 | public static readonly DependencyProperty ItemBrushProperty =
31 | DependencyProperty.Register("ItemBrush",
32 | typeof(Brush),
33 | typeof(ChartLegendItemViewModel),
34 | new PropertyMetadata(null));
35 |
36 | public string Caption
37 | {
38 | get { return (string)GetValue(CaptionProperty); }
39 | set { SetValue(CaptionProperty, value); }
40 | }
41 |
42 | public Brush ItemBrush
43 | {
44 | get { return (Brush)GetValue(ItemBrushProperty); }
45 | set { SetValue(ItemBrushProperty, value); }
46 | }
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/TestApplication.Shared/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("TestApplication.Shared")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("TestApplication.Shared")]
13 | [assembly: AssemblyCopyright("Copyright © 2012")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 |
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM
23 | [assembly: Guid("b5d86eba-af2f-4a96-8b39-12b5e161b265")]
24 |
25 | // Version information for an assembly consists of the following four values:
26 | //
27 | // Major Version
28 | // Minor Version
29 | // Build Number
30 | // Revision
31 | //
32 | // You can specify all the values or you can default the Build and Revision Numbers
33 | // by using the '*' as shown below:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/TestApplicationSL/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // Allgemeine Informationen über eine Assembly werden über die folgenden
6 | // Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern,
7 | // die mit einer Assembly verknüpft sind.
8 | [assembly: AssemblyTitle("TestApplicationSL")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("TestApplicationSL")]
13 | [assembly: AssemblyCopyright("Copyright © 2012")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Durch Festlegen von "ComVisible" auf "false" werden die Typen in dieser Assembly unsichtbar
18 | // für COM-Komponenten. Wenn Sie auf einen Typen in dieser Assembly von
19 | // COM zugreifen müssen, legen Sie das ComVisible-Attribut für diesen Typ auf "true" fest.
20 | [assembly: ComVisible(false)]
21 |
22 | // Die folgende GUID bestimmt die ID der Typbibliothek, wenn dieses Projekt für COM verfügbar gemacht wird
23 | [assembly: Guid("8f0a4417-85c6-4545-b9b2-5ff99035e369")]
24 |
25 | // Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten:
26 | //
27 | // Hauptversion
28 | // Nebenversion
29 | // Buildnummer
30 | // Revision
31 | //
32 | // Sie können alle Werte festlegen, oder Sie können die Standardwerte für die Revisions- und Buildnummern
33 | // übernehmen, indem Sie "*" eingeben:
34 | [assembly: AssemblyVersion("1.0.0.0")]
35 | [assembly: AssemblyFileVersion("1.0.0.0")]
36 |
--------------------------------------------------------------------------------
/De.TorstenMandelkow.MetroChart.SL/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // Allgemeine Informationen über eine Assembly werden über die folgenden
6 | // Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern,
7 | // die mit einer Assembly verknüpft sind.
8 | [assembly: AssemblyTitle("De.TorstenMandelkow.MetroChart.SL")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("De.TorstenMandelkow.MetroChart.SL")]
13 | [assembly: AssemblyCopyright("Copyright © 2012")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Durch Festlegen von "ComVisible" auf "false" werden die Typen in dieser Assembly unsichtbar
18 | // für COM-Komponenten. Wenn Sie auf einen Typen in dieser Assembly von
19 | // COM zugreifen müssen, legen Sie das ComVisible-Attribut für diesen Typ auf "true" fest.
20 | [assembly: ComVisible(false)]
21 |
22 | // Die folgende GUID bestimmt die ID der Typbibliothek, wenn dieses Projekt für COM verfügbar gemacht wird.
23 | [assembly: Guid("46dd5fb9-30e3-488f-8ff5-13f33dc5a488")]
24 |
25 | // Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten:
26 | //
27 | // Hauptversion
28 | // Nebenversion
29 | // Buildnummer
30 | // Revision
31 | //
32 | // Sie können alle Werte festlegen, oder Sie können die Standardwerte für die Revisions- und Buildnummern
33 | // übernehmen, indem Sie "*" eingeben:
34 | [assembly: AssemblyVersion("1.0.0.0")]
35 | [assembly: AssemblyFileVersion("1.0.0.0")]
36 |
--------------------------------------------------------------------------------
/De.TorstenMandelkow.MetroChart/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // Allgemeine Informationen über eine Assembly werden über die folgenden
6 | // Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern,
7 | // die mit einer Assembly verknüpft sind.
8 | [assembly: AssemblyTitle("De.TorstenMandelkow.MetroChart")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("De.TorstenMandelkow.MetroChart")]
13 | [assembly: AssemblyCopyright("Copyright © 2012")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Durch Festlegen von ComVisible auf "false" werden die Typen in dieser Assembly unsichtbar
18 | // für COM-Komponenten. Wenn Sie auf einen Typ in dieser Assembly von
19 | // COM zugreifen müssen, legen Sie das ComVisible-Attribut für diesen Typ auf "true" fest.
20 | [assembly: ComVisible(false)]
21 |
22 | // Die folgende GUID bestimmt die ID der Typbibliothek, wenn dieses Projekt für COM verfügbar gemacht wird
23 | [assembly: Guid("8b692c00-8dc9-4c47-bd74-0ec092c27bb8")]
24 |
25 | // Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten:
26 | //
27 | // Hauptversion
28 | // Nebenversion
29 | // Buildnummer
30 | // Revision
31 | //
32 | // Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern
33 | // übernehmen, indem Sie "*" eingeben:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/De.TorstenMandelkow.MetroChart/Controls/RowSeriesPanel.cs:
--------------------------------------------------------------------------------
1 | namespace De.TorstenMandelkow.MetroChart
2 | {
3 | using System;
4 | using System.Collections.Generic;
5 | using System.Linq;
6 | using System.Text;
7 |
8 | #if NETFX_CORE
9 | using Windows.UI.Xaml.Controls;
10 | using Windows.UI.Xaml.Media;
11 | using Windows.UI.Xaml.Shapes;
12 | using Windows.UI.Xaml.Markup;
13 | using Windows.UI.Xaml;
14 | using Windows.Foundation;
15 | using Windows.UI;
16 | using Windows.UI.Xaml.Media.Animation;
17 | using Windows.UI.Core;
18 | #else
19 | using System.Windows.Media;
20 | using System.Windows.Controls;
21 | using System.Windows;
22 | #endif
23 |
24 | #if SILVERLIGHT
25 | public class RowSeriesPanel : Panel
26 | #else
27 | public class RowSeriesPanel : Grid
28 | #endif
29 | {
30 | protected override Size MeasureOverride(Size availableSize)
31 | {
32 | foreach (UIElement child in Children)
33 | child.Measure(availableSize);
34 |
35 | return base.MeasureOverride(availableSize);
36 | }
37 |
38 | protected override Size ArrangeOverride(Size finalSize)
39 | {
40 | Size cellSize = new Size(finalSize.Width, finalSize.Height / Children.Count);
41 | int row = 0, col = 0;
42 |
43 | double leftposition = 0;
44 | foreach (UIElement child in Children)
45 | {
46 | double height= finalSize.Height;
47 | double width = child.DesiredSize.Width;
48 | double x = leftposition;
49 | double y = 0;
50 | Rect rect = new Rect(x, y, width, height);
51 | child.Arrange(rect);
52 |
53 | leftposition += width;
54 | col++;
55 | }
56 | return finalSize;
57 | }
58 | }
59 | }
60 |
--------------------------------------------------------------------------------
/De.TorstenMandelkow.MetroChart/Controls/StackedColumnsPanel.cs:
--------------------------------------------------------------------------------
1 | namespace De.TorstenMandelkow.MetroChart
2 | {
3 | using System;
4 | using System.Collections.Generic;
5 | using System.Linq;
6 | using System.Text;
7 |
8 | #if NETFX_CORE
9 | using Windows.UI.Xaml.Controls;
10 | using Windows.UI.Xaml.Media;
11 | using Windows.UI.Xaml.Shapes;
12 | using Windows.UI.Xaml.Markup;
13 | using Windows.UI.Xaml;
14 | using Windows.Foundation;
15 | using Windows.UI;
16 | using Windows.UI.Xaml.Media.Animation;
17 | using Windows.UI.Core;
18 | #else
19 | using System.Windows.Media;
20 | using System.Windows.Controls;
21 | using System.Windows;
22 | #endif
23 |
24 | #if SILVERLIGHT
25 | public class StackedColumnsPanel : Panel
26 | #else
27 | public class StackedColumnsPanel : Grid
28 | #endif
29 | {
30 | protected override Size MeasureOverride(Size availableSize)
31 | {
32 | foreach (UIElement child in Children)
33 | child.Measure(availableSize);
34 |
35 | return base.MeasureOverride(availableSize);
36 | }
37 |
38 | protected override Size ArrangeOverride(Size finalSize)
39 | {
40 | Size cellSize = new Size(finalSize.Width / Children.Count, finalSize.Height);
41 | int row = 0, col = 0;
42 |
43 | double bottomposition = finalSize.Height;
44 | foreach (UIElement child in Children)
45 | {
46 | double width= finalSize.Width;
47 | double height = child.DesiredSize.Height;
48 | double x = 0;
49 | double y = bottomposition - height;
50 | Rect rect = new Rect(x, y, width, height);
51 | child.Arrange(rect);
52 |
53 | bottomposition -= height;
54 | col++;
55 | }
56 | return finalSize;
57 | }
58 | }
59 | }
60 |
--------------------------------------------------------------------------------
/De.TorstenMandelkow.MetroChart/Core/GaugeChart/RadialGaugeChart.cs:
--------------------------------------------------------------------------------
1 | namespace De.TorstenMandelkow.MetroChart
2 | {
3 | using System;
4 | using System.Collections.Generic;
5 | using System.Collections.Specialized;
6 | using System.Linq;
7 | using System.Text;
8 | using System.Windows;
9 |
10 | #if NETFX_CORE
11 | using Windows.UI.Xaml.Controls;
12 | using Windows.UI.Xaml.Media;
13 | using Windows.UI.Xaml.Shapes;
14 | using Windows.UI.Xaml.Markup;
15 | using Windows.UI.Xaml;
16 | using Windows.Foundation;
17 | using Windows.UI;
18 | using Windows.UI.Xaml.Media.Animation;
19 | using Windows.UI.Core;
20 | #else
21 | using System.Windows.Media;
22 | using System.Windows.Controls;
23 | using System.Windows.Data;
24 | #endif
25 |
26 |
27 | public class RadialGaugeChart : ChartBase
28 | {
29 | #region Constructors
30 |
31 | ///
32 | /// Initializes the class.
33 | ///
34 | static RadialGaugeChart()
35 | {
36 | #if NETFX_CORE
37 |
38 | #elif SILVERLIGHT
39 |
40 | #else
41 | DefaultStyleKeyProperty.OverrideMetadata(typeof(RadialGaugeChart), new FrameworkPropertyMetadata(typeof(RadialGaugeChart)));
42 | #endif
43 | }
44 |
45 | ///
46 | /// Initializes a new instance of the class.
47 | ///
48 | public RadialGaugeChart()
49 | {
50 | #if NETFX_CORE
51 | this.DefaultStyleKey = typeof(RadialGaugeChart);
52 | #endif
53 | #if SILVERLIGHT
54 | this.DefaultStyleKey = typeof(RadialGaugeChart);
55 | #endif
56 | }
57 |
58 | #endregion Constructors
59 |
60 | protected override double GridLinesMaxValue
61 | {
62 | get
63 | {
64 | return 0.0;
65 | }
66 | }
67 | }
68 | }
--------------------------------------------------------------------------------
/De.TorstenMandelkow.MetroChart/Core/BarChart/StackedBar100Chart.cs:
--------------------------------------------------------------------------------
1 | namespace De.TorstenMandelkow.MetroChart
2 | {
3 | using System;
4 | using System.Collections.Generic;
5 | using System.Linq;
6 | using System.Text;
7 | using System.Windows;
8 | using System.Windows.Input;
9 |
10 | #if NETFX_CORE
11 | using Windows.UI.Xaml.Controls;
12 | using Windows.UI.Xaml.Media;
13 | using Windows.UI.Xaml.Shapes;
14 | using Windows.UI.Xaml.Markup;
15 | using Windows.UI.Xaml;
16 | using Windows.Foundation;
17 | using Windows.UI;
18 | using Windows.UI.Xaml.Media.Animation;
19 | using Windows.UI.Core;
20 | #else
21 | using System.Windows.Media;
22 | using System.Windows.Controls;
23 | #endif
24 |
25 | ///
26 | /// Represents an Instance of the bar-chart
27 | ///
28 | public class StackedBar100Chart : ChartBase
29 | {
30 | ///
31 | /// Initializes the class.
32 | ///
33 | static StackedBar100Chart()
34 | {
35 | #if NETFX_CORE
36 |
37 | #elif SILVERLIGHT
38 |
39 | #else
40 | DefaultStyleKeyProperty.OverrideMetadata(typeof(StackedBar100Chart), new FrameworkPropertyMetadata(typeof(StackedBar100Chart)));
41 | #endif
42 | }
43 |
44 | ///
45 | /// Initializes a new instance of the class.
46 | ///
47 | public StackedBar100Chart()
48 | {
49 | #if NETFX_CORE
50 | this.DefaultStyleKey = typeof(StackedBar100Chart);
51 | #endif
52 | #if SILVERLIGHT
53 | this.DefaultStyleKey = typeof(StackedBar100Chart);
54 | #endif
55 | }
56 |
57 | protected override double GridLinesMaxValue
58 | {
59 | get
60 | {
61 | return 100.0;
62 | }
63 | }
64 | }
65 | }
--------------------------------------------------------------------------------
/De.TorstenMandelkow.MetroChart/Core/ColumnChart/StackedColumn100Chart.cs:
--------------------------------------------------------------------------------
1 | namespace De.TorstenMandelkow.MetroChart
2 | {
3 | using System;
4 | using System.Collections.Generic;
5 | using System.Linq;
6 | using System.Text;
7 | using System.Windows;
8 | using System.Windows.Input;
9 |
10 | #if NETFX_CORE
11 | using Windows.UI.Xaml.Controls;
12 | using Windows.UI.Xaml.Media;
13 | using Windows.UI.Xaml.Shapes;
14 | using Windows.UI.Xaml.Markup;
15 | using Windows.UI.Xaml;
16 | using Windows.Foundation;
17 | using Windows.UI;
18 | using Windows.UI.Xaml.Media.Animation;
19 | using Windows.UI.Core;
20 | #else
21 | using System.Windows.Media;
22 | using System.Windows.Controls;
23 | #endif
24 |
25 | ///
26 | /// Represents an Instance of the bar-chart
27 | ///
28 | public class StackedColumn100Chart : ChartBase
29 | {
30 | ///
31 | /// Initializes the class.
32 | ///
33 | static StackedColumn100Chart()
34 | {
35 | #if NETFX_CORE
36 |
37 | #elif SILVERLIGHT
38 |
39 | #else
40 | DefaultStyleKeyProperty.OverrideMetadata(typeof(StackedColumn100Chart), new FrameworkPropertyMetadata(typeof(StackedColumn100Chart)));
41 | #endif
42 | }
43 |
44 | ///
45 | /// Initializes a new instance of the class.
46 | ///
47 | public StackedColumn100Chart()
48 | {
49 | #if NETFX_CORE
50 | this.DefaultStyleKey = typeof(StackedColumn100Chart);
51 | #endif
52 | #if SILVERLIGHT
53 | this.DefaultStyleKey = typeof(StackedColumn100Chart);
54 | #endif
55 | }
56 |
57 | protected override double GridLinesMaxValue
58 | {
59 | get
60 | {
61 | return 100.0;
62 | }
63 | }
64 | }
65 | }
--------------------------------------------------------------------------------
/De.TorstenMandelkow.MetroChart/Converters/DoubleToGridLengthPercent.cs:
--------------------------------------------------------------------------------
1 | namespace De.TorstenMandelkow.MetroChart
2 | {
3 | using System;
4 | using System.Collections.Generic;
5 | using System.Linq;
6 | using System.Text;
7 |
8 | #if NETFX_CORE
9 | using Windows.UI.Xaml.Data;
10 | using Windows.UI.Xaml;
11 | #else
12 | using System.Windows.Controls;
13 | using System.Windows;
14 | using System.Windows.Data;
15 | #endif
16 |
17 | public class DoubleToGridLengthPercent : IValueConverter
18 | {
19 | #if NETFX_CORE
20 | public object Convert(object value, Type targetType, object parameter, string language)
21 | {
22 | return InternalConvert(value, targetType, parameter);
23 | }
24 |
25 | public object ConvertBack(object value, Type targetType, object parameter, string language)
26 | {
27 | throw new NotImplementedException();
28 | }
29 | #else
30 | public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
31 | {
32 | return InternalConvert(value, targetType, parameter);
33 | }
34 |
35 | public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
36 | {
37 | throw new NotImplementedException();
38 | }
39 | #endif
40 |
41 | private object InternalConvert(object value, Type targetType, object parameter)
42 | {
43 | double percentage = (double)value;
44 | if (parameter != null)
45 | {
46 | if (percentage <= 1)
47 | {
48 | return new GridLength(1.0 - (double)percentage, GridUnitType.Star);
49 | }
50 | return new GridLength(100.0 - (double)percentage, GridUnitType.Star);
51 | }
52 | else
53 | {
54 | return new GridLength((double)percentage, GridUnitType.Star);
55 | }
56 | }
57 | }
58 | }
59 |
--------------------------------------------------------------------------------
/De.TorstenMandelkow.MetroChart/Core/BarChart/StackedBarChart.cs:
--------------------------------------------------------------------------------
1 | namespace De.TorstenMandelkow.MetroChart
2 | {
3 | using System;
4 | using System.Collections.Generic;
5 | using System.Linq;
6 | using System.Text;
7 | using System.Windows;
8 | using System.Windows.Input;
9 |
10 | #if NETFX_CORE
11 | using Windows.UI.Xaml.Controls;
12 | using Windows.UI.Xaml.Media;
13 | using Windows.UI.Xaml.Shapes;
14 | using Windows.UI.Xaml.Markup;
15 | using Windows.UI.Xaml;
16 | using Windows.Foundation;
17 | using Windows.UI;
18 | using Windows.UI.Xaml.Media.Animation;
19 | using Windows.UI.Core;
20 | #else
21 | using System.Windows.Media;
22 | using System.Windows.Controls;
23 | #endif
24 |
25 | ///
26 | /// Represents an Instance of the bar-chart
27 | ///
28 | public class StackedBarChart : ChartBase
29 | {
30 | ///
31 | /// Initializes the class.
32 | ///
33 | static StackedBarChart()
34 | {
35 | #if NETFX_CORE
36 |
37 | #elif SILVERLIGHT
38 |
39 | #else
40 | DefaultStyleKeyProperty.OverrideMetadata(typeof(StackedBarChart), new FrameworkPropertyMetadata(typeof(StackedBarChart)));
41 | #endif
42 | }
43 |
44 | ///
45 | /// Initializes a new instance of the class.
46 | ///
47 | public StackedBarChart()
48 | {
49 | #if NETFX_CORE
50 | this.DefaultStyleKey = typeof(StackedBarChart);
51 | #endif
52 | #if SILVERLIGHT
53 | this.DefaultStyleKey = typeof(StackedBarChart);
54 | #endif
55 | }
56 |
57 | protected override double GridLinesMaxValue
58 | {
59 | get
60 | {
61 | return MaxDataPointGroupSum;
62 | }
63 | }
64 |
65 | protected override void OnMaxDataPointGroupSumChanged(double p)
66 | {
67 | UpdateGridLines();
68 | }
69 | }
70 | }
--------------------------------------------------------------------------------
/De.TorstenMandelkow.MetroChart/Core/ColumnChart/StackedColumnChart.cs:
--------------------------------------------------------------------------------
1 | namespace De.TorstenMandelkow.MetroChart
2 | {
3 | using System;
4 | using System.Collections.Generic;
5 | using System.Linq;
6 | using System.Text;
7 | using System.Windows;
8 | using System.Windows.Input;
9 |
10 | #if NETFX_CORE
11 | using Windows.UI.Xaml.Controls;
12 | using Windows.UI.Xaml.Media;
13 | using Windows.UI.Xaml.Shapes;
14 | using Windows.UI.Xaml.Markup;
15 | using Windows.UI.Xaml;
16 | using Windows.Foundation;
17 | using Windows.UI;
18 | using Windows.UI.Xaml.Media.Animation;
19 | using Windows.UI.Core;
20 | #else
21 | using System.Windows.Media;
22 | using System.Windows.Controls;
23 | #endif
24 |
25 | ///
26 | /// Represents an Instance of the bar-chart
27 | ///
28 | public class StackedColumnChart : ChartBase
29 | {
30 | ///
31 | /// Initializes the class.
32 | ///
33 | static StackedColumnChart()
34 | {
35 | #if NETFX_CORE
36 |
37 | #elif SILVERLIGHT
38 |
39 | #else
40 | DefaultStyleKeyProperty.OverrideMetadata(typeof(StackedColumnChart), new FrameworkPropertyMetadata(typeof(StackedColumnChart)));
41 | #endif
42 | }
43 |
44 | ///
45 | /// Initializes a new instance of the class.
46 | ///
47 | public StackedColumnChart()
48 | {
49 | #if NETFX_CORE
50 | this.DefaultStyleKey = typeof(StackedColumnChart);
51 | #endif
52 | #if SILVERLIGHT
53 | this.DefaultStyleKey = typeof(StackedColumnChart);
54 | #endif
55 | }
56 |
57 | protected override double GridLinesMaxValue
58 | {
59 | get
60 | {
61 | return MaxDataPointGroupSum;
62 | }
63 | }
64 |
65 | protected override void OnMaxDataPointGroupSumChanged(double p)
66 | {
67 | UpdateGridLines();
68 | }
69 | }
70 | }
--------------------------------------------------------------------------------
/De.TorstenMandelkow.MetroChart/ChartControls/ChartTitle.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | #if NETFX_CORE
7 |
8 | using Windows.UI.Xaml;
9 | using Windows.UI.Xaml.Controls;
10 | using Windows.UI.Xaml.Media.Animation;
11 |
12 | #else
13 |
14 | using System.Windows.Controls;
15 | using System.Windows;
16 | using System.Windows.Media.Animation;
17 |
18 | #endif
19 |
20 | namespace De.TorstenMandelkow.MetroChart
21 | {
22 | public class ChartTitle : ContentControl
23 | {
24 | public static readonly DependencyProperty TitleProperty =
25 | DependencyProperty.Register("Title", typeof(string), typeof(ChartTitle),
26 | new PropertyMetadata(null));
27 | public static readonly DependencyProperty SubTitleProperty =
28 | DependencyProperty.Register("SubTitle", typeof(string), typeof(ChartTitle),
29 | new PropertyMetadata(null));
30 |
31 | static ChartTitle()
32 | {
33 | #if NETFX_CORE
34 | //do nothing
35 | #elif SILVERLIGHT
36 | //do nothing
37 | #else
38 | DefaultStyleKeyProperty.OverrideMetadata(typeof(ChartTitle), new FrameworkPropertyMetadata(typeof(ChartTitle)));
39 | #endif
40 | }
41 |
42 | public ChartTitle()
43 | {
44 | #if NETFX_CORE
45 | this.DefaultStyleKey = typeof(ChartTitle);
46 | #elif SILVERLIGHT
47 | this.DefaultStyleKey = typeof(ChartTitle);
48 | #else
49 | //do nothing
50 | #endif
51 | }
52 |
53 | public string Title
54 | {
55 | get
56 | {
57 | return (string)GetValue(TitleProperty);
58 | }
59 | set
60 | {
61 | SetValue(TitleProperty, value);
62 | }
63 | }
64 |
65 | public string SubTitle
66 | {
67 | get
68 | {
69 | return (string)GetValue(SubTitleProperty);
70 | }
71 | set
72 | {
73 | SetValue(SubTitleProperty, value);
74 | }
75 | }
76 | }
77 | }
78 |
--------------------------------------------------------------------------------
/TestApplication.Shared/Controls/StringToDataTemplateConverter.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | #if NETFX_CORE
8 | using Windows.UI.Xaml.Data;
9 | using Windows.UI.Xaml;
10 | using Windows.UI.Xaml.Controls;
11 |
12 | #else
13 |
14 | using System.Windows;
15 | using System.Windows.Data;
16 | using System.Globalization;
17 | using System.Windows.Controls;
18 |
19 | #endif
20 |
21 | namespace TestApplication.Shared
22 | {
23 | public class StringToDataTemplateConverter : IValueConverter
24 | {
25 | #if NETFX_CORE
26 |
27 | public object Convert(object value, Type targetType, object parameter, string language)
28 | {
29 | return InternalConvert(value, targetType, parameter);
30 | }
31 |
32 | public object ConvertBack(object value, Type targetType, object parameter, string language)
33 | {
34 | throw new NotImplementedException();
35 | }
36 |
37 | #else
38 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
39 | {
40 | return InternalConvert(value, targetType, parameter);
41 | }
42 |
43 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
44 | {
45 | throw new NotImplementedException();
46 | }
47 |
48 | #endif
49 |
50 | public object InternalConvert(object value, Type targetType, object parameter)
51 | {
52 | if(value == null)
53 | {
54 | return null;
55 | }
56 |
57 | var resources = Application.Current.Resources.MergedDictionaries.ToList();
58 |
59 | foreach (var dict in resources)
60 | {
61 | foreach (var objkey in dict.Keys)
62 | {
63 | if (objkey.ToString() == value.ToString())
64 | {
65 | return dict[objkey] as DataTemplate;
66 | }
67 | }
68 | }
69 |
70 | return null;
71 | }
72 | }
73 | }
74 |
--------------------------------------------------------------------------------
/De.TorstenMandelkow.MetroChart.WPF/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 | using System.Windows;
5 |
6 |
7 | // Allgemeine Informationen über eine Assembly werden über die folgenden
8 | // Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern,
9 | // die mit einer Assembly verknüpft sind.
10 | [assembly: AssemblyTitle("De.TorstenMandelkow.MetroChart.WPF")]
11 | [assembly: AssemblyDescription("")]
12 | [assembly: AssemblyConfiguration("")]
13 | [assembly: AssemblyCompany("")]
14 | [assembly: AssemblyProduct("De.TorstenMandelkow.MetroChart.WPF")]
15 | [assembly: AssemblyCopyright("Copyright © 2012")]
16 | [assembly: AssemblyTrademark("")]
17 | [assembly: AssemblyCulture("")]
18 |
19 | [assembly: ThemeInfo(
20 | ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
21 | //(used if a resource is not found in the page,
22 | // or application resource dictionaries)
23 | ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
24 | //(used if a resource is not found in the page,
25 | // app, or any theme specific resource dictionaries)
26 | )]
27 |
28 | // Durch Festlegen von ComVisible auf "false" werden die Typen in dieser Assembly unsichtbar
29 | // für COM-Komponenten. Wenn Sie auf einen Typ in dieser Assembly von
30 | // COM zugreifen müssen, legen Sie das ComVisible-Attribut für diesen Typ auf "true" fest.
31 | [assembly: ComVisible(false)]
32 |
33 | // Die folgende GUID bestimmt die ID der Typbibliothek, wenn dieses Projekt für COM verfügbar gemacht wird
34 | [assembly: Guid("b9d83966-a650-418f-825b-619184b1748c")]
35 |
36 | // Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten:
37 | //
38 | // Hauptversion
39 | // Nebenversion
40 | // Buildnummer
41 | // Revision
42 | //
43 | // Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern
44 | // übernehmen, indem Sie "*" eingeben:
45 | // [assembly: AssemblyVersion("1.0.*")]
46 | [assembly: AssemblyVersion("1.0.0.0")]
47 | [assembly: AssemblyFileVersion("1.0.0.0")]
48 |
--------------------------------------------------------------------------------
/De.TorstenMandelkow.MetroChart/ChartControls/Legend.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections;
3 | namespace De.TorstenMandelkow.MetroChart
4 | {
5 | using System.Collections.Generic;
6 | using System.Collections.ObjectModel;
7 | using System.Linq;
8 | using System.Text;
9 | using System.Collections.Specialized;
10 |
11 | #if NETFX_CORE
12 | using Windows.UI.Xaml.Controls;
13 | using Windows.UI.Xaml.Media;
14 | using Windows.UI.Xaml.Shapes;
15 | using Windows.UI.Xaml.Markup;
16 | using Windows.UI.Xaml;
17 | using Windows.Foundation;
18 | using Windows.UI;
19 | using Windows.UI.Xaml.Media.Animation;
20 | using Windows.UI.Core;
21 | using Windows.UI.Xaml.Data;
22 |
23 | #else
24 | using System.Windows.Media;
25 | using System.Windows.Controls;
26 | using System.Windows;
27 | #endif
28 |
29 | public class Legend : ItemsControl
30 | {
31 | static Legend()
32 | {
33 | #if NETFX_CORE
34 |
35 | #elif SILVERLIGHT
36 |
37 | #else
38 | DefaultStyleKeyProperty.OverrideMetadata(typeof(Legend), new FrameworkPropertyMetadata(typeof(Legend)));
39 | #endif
40 | }
41 |
42 | ///
43 | /// Initializes a new instance of the class.
44 | ///
45 | public Legend()
46 | {
47 | #if NETFX_CORE
48 | this.DefaultStyleKey = typeof(Legend);
49 | #endif
50 | #if SILVERLIGHT
51 | this.DefaultStyleKey = typeof(Legend);
52 | #endif
53 | }
54 |
55 | public static readonly DependencyProperty ChartLegendItemStyleProperty =
56 | DependencyProperty.Register("ChartLegendItemStyle",
57 | typeof(Style),
58 | typeof(Legend),
59 | new PropertyMetadata(null, OnStyleChanged));
60 |
61 | private static void OnStyleChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
62 | {
63 |
64 | }
65 |
66 | public Style ChartLegendItemStyle
67 | {
68 | get { return (Style)GetValue(ChartLegendItemStyleProperty); }
69 | set { SetValue(ChartLegendItemStyleProperty, value); }
70 | }
71 | }
72 | }
73 |
--------------------------------------------------------------------------------
/De.TorstenMandelkow.MetroChart/Core/BarChart/ClusteredBarChart.cs:
--------------------------------------------------------------------------------
1 | namespace De.TorstenMandelkow.MetroChart
2 | {
3 | using System;
4 | using System.Collections.Generic;
5 | using System.Linq;
6 | using System.Text;
7 | using System.Windows;
8 | using System.Windows.Input;
9 |
10 | #if NETFX_CORE
11 | using Windows.UI.Xaml.Controls;
12 | using Windows.UI.Xaml.Media;
13 | using Windows.UI.Xaml.Shapes;
14 | using Windows.UI.Xaml.Markup;
15 | using Windows.UI.Xaml;
16 | using Windows.Foundation;
17 | using Windows.UI;
18 | using Windows.UI.Xaml.Media.Animation;
19 | using Windows.UI.Core;
20 | #else
21 | using System.Windows.Media;
22 | using System.Windows.Controls;
23 | #endif
24 |
25 | ///
26 | /// Represents an Instance of the bar-chart
27 | ///
28 | public class ClusteredBarChart : ChartBase
29 | {
30 | #region Constructors
31 |
32 | ///
33 | /// Initializes the class.
34 | ///
35 | static ClusteredBarChart()
36 | {
37 | #if NETFX_CORE
38 |
39 | #elif SILVERLIGHT
40 |
41 | #else
42 | DefaultStyleKeyProperty.OverrideMetadata(typeof(ClusteredBarChart), new FrameworkPropertyMetadata(typeof(ClusteredBarChart)));
43 | #endif
44 | }
45 |
46 | ///
47 | /// Initializes a new instance of the class.
48 | ///
49 | public ClusteredBarChart()
50 | {
51 | #if NETFX_CORE
52 | this.DefaultStyleKey = typeof(ClusteredBarChart);
53 | #endif
54 | #if SILVERLIGHT
55 | this.DefaultStyleKey = typeof(ClusteredBarChart);
56 | #endif
57 | }
58 |
59 | #endregion Constructors
60 |
61 | protected override double GridLinesMaxValue
62 | {
63 | get
64 | {
65 | return MaxDataPointValue;
66 | }
67 | }
68 |
69 | protected override void OnMaxDataPointValueChanged(double p)
70 | {
71 | UpdateGridLines();
72 | }
73 |
74 | public override bool IsUseNextBiggestMaxValue
75 | {
76 | get
77 | {
78 | return true;
79 | }
80 | }
81 | }
82 | }
--------------------------------------------------------------------------------
/De.TorstenMandelkow.MetroChart/Core/ColumnChart/ClusteredColumnChart.cs:
--------------------------------------------------------------------------------
1 | namespace De.TorstenMandelkow.MetroChart
2 | {
3 | using System;
4 | using System.Collections.Generic;
5 | using System.Linq;
6 | using System.Text;
7 | using System.Windows;
8 | using System.Windows.Input;
9 |
10 | #if NETFX_CORE
11 | using Windows.UI.Xaml.Controls;
12 | using Windows.UI.Xaml.Media;
13 | using Windows.UI.Xaml.Shapes;
14 | using Windows.UI.Xaml.Markup;
15 | using Windows.UI.Xaml;
16 | using Windows.Foundation;
17 | using Windows.UI;
18 | using Windows.UI.Xaml.Media.Animation;
19 | using Windows.UI.Core;
20 | #else
21 | using System.Windows.Media;
22 | using System.Windows.Controls;
23 | #endif
24 |
25 | ///
26 | /// Represents an Instance of the bar-chart
27 | ///
28 | public class ClusteredColumnChart : ChartBase
29 | {
30 | #region Fields
31 |
32 | #endregion Fields
33 |
34 | #region Constructors
35 |
36 | ///
37 | /// Initializes the class.
38 | ///
39 | static ClusteredColumnChart()
40 | {
41 | #if NETFX_CORE
42 |
43 | #elif SILVERLIGHT
44 |
45 | #else
46 | DefaultStyleKeyProperty.OverrideMetadata(typeof(ClusteredColumnChart), new FrameworkPropertyMetadata(typeof(ClusteredColumnChart)));
47 | #endif
48 | }
49 |
50 | ///
51 | /// Initializes a new instance of the class.
52 | ///
53 | public ClusteredColumnChart()
54 | {
55 | #if NETFX_CORE
56 | this.DefaultStyleKey = typeof(ClusteredColumnChart);
57 | #endif
58 | #if SILVERLIGHT
59 | this.DefaultStyleKey = typeof(ClusteredColumnChart);
60 | #endif
61 | }
62 |
63 | #endregion Constructors
64 |
65 | protected override double GridLinesMaxValue
66 | {
67 | get
68 | {
69 | return MaxDataPointValue;
70 | }
71 | }
72 |
73 | protected override void OnMaxDataPointValueChanged(double p)
74 | {
75 | UpdateGridLines();
76 | }
77 |
78 | public override bool IsUseNextBiggestMaxValue
79 | {
80 | get
81 | {
82 | return true;
83 | }
84 | }
85 | }
86 | }
--------------------------------------------------------------------------------
/TestApplication.WinRT/Common/BindableBase.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.ComponentModel;
3 | using System.Runtime.CompilerServices;
4 | using Windows.UI.Xaml.Data;
5 |
6 | namespace TestApplication.WinRT.Common
7 | {
8 | ///
9 | /// Implementation of to simplify models.
10 | ///
11 | [Windows.Foundation.Metadata.WebHostHidden]
12 | public abstract class BindableBase : INotifyPropertyChanged
13 | {
14 | ///
15 | /// Multicast event for property change notifications.
16 | ///
17 | public event PropertyChangedEventHandler PropertyChanged;
18 |
19 | ///
20 | /// Checks if a property already matches a desired value. Sets the property and
21 | /// notifies listeners only when necessary.
22 | ///
23 | /// Type of the property.
24 | /// Reference to a property with both getter and setter.
25 | /// Desired value for the property.
26 | /// Name of the property used to notify listeners. This
27 | /// value is optional and can be provided automatically when invoked from compilers that
28 | /// support CallerMemberName.
29 | /// True if the value was changed, false if the existing value matched the
30 | /// desired value.
31 | protected bool SetProperty(ref T storage, T value, [CallerMemberName] String propertyName = null)
32 | {
33 | if (object.Equals(storage, value)) return false;
34 |
35 | storage = value;
36 | this.OnPropertyChanged(propertyName);
37 | return true;
38 | }
39 |
40 | ///
41 | /// Notifies listeners that a property value has changed.
42 | ///
43 | /// Name of the property used to notify listeners. This
44 | /// value is optional and can be provided automatically when invoked from compilers
45 | /// that support .
46 | protected void OnPropertyChanged([CallerMemberName] string propertyName = null)
47 | {
48 | var eventHandler = this.PropertyChanged;
49 | if (eventHandler != null)
50 | {
51 | eventHandler(this, new PropertyChangedEventArgs(propertyName));
52 | }
53 | }
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Microsoft Public License (Ms-PL)
2 |
3 | This license governs use of the accompanying software. If you use the software, you
4 | accept this license. If you do not accept the license, do not use the software.
5 |
6 | 1. Definitions
7 | The terms "reproduce," "reproduction," "derivative works," and "distribution" have the
8 | same meaning here as under U.S. copyright law.
9 | A "contribution" is the original software, or any additions or changes to the software.
10 | A "contributor" is any person that distributes its contribution under this license.
11 | "Licensed patents" are a contributor's patent claims that read directly on its contribution.
12 |
13 | 2. Grant of Rights
14 | (A) Copyright Grant- Subject to the terms of this license, including the license conditions and limitations in section 3, each contributor grants you a non-exclusive, worldwide, royalty-free copyright license to reproduce its contribution, prepare derivative works of its contribution, and distribute its contribution or any derivative works that you create.
15 | (B) Patent Grant- Subject to the terms of this license, including the license conditions and limitations in section 3, each contributor grants you a non-exclusive, worldwide, royalty-free license under its licensed patents to make, have made, use, sell, offer for sale, import, and/or otherwise dispose of its contribution in the software or derivative works of the contribution in the software.
16 |
17 | 3. Conditions and Limitations
18 | (A) No Trademark License- This license does not grant you rights to use any contributors' name, logo, or trademarks.
19 | (B) If you bring a patent claim against any contributor over patents that you claim are infringed by the software, your patent license from such contributor to the software ends automatically.
20 | (C) If you distribute any portion of the software, you must retain all copyright, patent, trademark, and attribution notices that are present in the software.
21 | (D) If you distribute any portion of the software in source code form, you may do so only under this license by including a complete copy of this license with your distribution. If you distribute any portion of the software in compiled or object code form, you may only do so under a license that complies with this license.
22 | (E) The software is licensed "as-is." You bear the risk of using it. The contributors give no express warranties, guarantees or conditions. You may have additional consumer rights under your local laws which this license cannot change. To the extent permitted under your local laws, the contributors exclude the implied warranties of merchantability, fitness for a particular purpose and non-infringement.
23 |
--------------------------------------------------------------------------------
/TestApplicationSL/App.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Net;
5 | using System.Windows;
6 | using System.Windows.Controls;
7 | using System.Windows.Documents;
8 | using System.Windows.Input;
9 | using System.Windows.Media;
10 | using System.Windows.Media.Animation;
11 | using System.Windows.Shapes;
12 |
13 | namespace TestApplicationSL
14 | {
15 | public partial class App : Application
16 | {
17 |
18 | public App()
19 | {
20 | this.Startup += this.Application_Startup;
21 | this.Exit += this.Application_Exit;
22 | this.UnhandledException += this.Application_UnhandledException;
23 |
24 | InitializeComponent();
25 | }
26 |
27 | private void Application_Startup(object sender, StartupEventArgs e)
28 | {
29 | this.RootVisual = new MainPage();
30 | }
31 |
32 | private void Application_Exit(object sender, EventArgs e)
33 | {
34 |
35 | }
36 |
37 | private void Application_UnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e)
38 | {
39 | // Wenn die Anwendung außerhalb des Debuggers ausgeführt wird, melden Sie die Ausnahme mithilfe
40 | // des Ausnahmemechanismus des Browsers. In IE wird hier ein gelbes Warnsymbol in der
41 | // Statusleiste angezeigt, Firefox zeigt einen Skriptfehler an.
42 | if (!System.Diagnostics.Debugger.IsAttached)
43 | {
44 |
45 | // Hinweis: So kann die Anwendung weiterhin ausgeführt werden, nachdem eine Ausnahme ausgelöst, aber nicht
46 | // behandelt wurde.
47 | // Bei Produktionsanwendungen sollte diese Fehlerbehandlung durch eine Anwendung ersetzt werden, die
48 | // den Fehler der Website meldet und die Anwendung beendet.
49 | e.Handled = true;
50 | Deployment.Current.Dispatcher.BeginInvoke(delegate { ReportErrorToDOM(e); });
51 | }
52 | }
53 |
54 | private void ReportErrorToDOM(ApplicationUnhandledExceptionEventArgs e)
55 | {
56 | try
57 | {
58 | string errorMsg = e.ExceptionObject.Message + e.ExceptionObject.StackTrace;
59 | errorMsg = errorMsg.Replace('"', '\'').Replace("\r\n", @"\n");
60 |
61 | System.Windows.Browser.HtmlPage.Window.Eval("throw new Error(\"Unhandled Error in Silverlight Application " + errorMsg + "\");");
62 | }
63 | catch (Exception)
64 | {
65 | }
66 | }
67 | }
68 | }
69 |
--------------------------------------------------------------------------------
/TestApplicationWPF/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Resources;
3 | using System.Runtime.CompilerServices;
4 | using System.Runtime.InteropServices;
5 | using System.Windows;
6 |
7 | // Allgemeine Informationen über eine Assembly werden über die folgenden
8 | // Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern,
9 | // die mit einer Assembly verknüpft sind.
10 | [assembly: AssemblyTitle("TestApplicationWPF")]
11 | [assembly: AssemblyDescription("")]
12 | [assembly: AssemblyConfiguration("")]
13 | [assembly: AssemblyCompany("")]
14 | [assembly: AssemblyProduct("TestApplicationWPF")]
15 | [assembly: AssemblyCopyright("Copyright © 2012")]
16 | [assembly: AssemblyTrademark("")]
17 | [assembly: AssemblyCulture("")]
18 |
19 | // Durch Festlegen von ComVisible auf "false" werden die Typen in dieser Assembly unsichtbar
20 | // für COM-Komponenten. Wenn Sie auf einen Typ in dieser Assembly von
21 | // COM zugreifen müssen, legen Sie das ComVisible-Attribut für diesen Typ auf "true" fest.
22 | [assembly: ComVisible(false)]
23 |
24 | //Um mit dem Erstellen lokalisierbarer Anwendungen zu beginnen, legen Sie
25 | //ImCodeVerwendeteKultur in der .csproj-Datei
26 | //in einer fest. Wenn Sie in den Quelldateien beispielsweise Deutsch
27 | //(Deutschland) verwenden, legen Sie auf \"de-DE\" fest. Heben Sie dann die Auskommentierung
28 | //des nachstehenden NeutralResourceLanguage-Attributs auf. Aktualisieren Sie "en-US" in der nachstehenden Zeile,
29 | //sodass es mit der UICulture-Einstellung in der Projektdatei übereinstimmt.
30 |
31 | //[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
32 |
33 |
34 | [assembly: ThemeInfo(
35 | ResourceDictionaryLocation.None, //Speicherort der designspezifischen Ressourcenwörterbücher
36 | //(wird verwendet, wenn eine Ressource auf der Seite
37 | // oder in den Anwendungsressourcen-Wörterbüchern nicht gefunden werden kann.)
38 | ResourceDictionaryLocation.SourceAssembly //Speicherort des generischen Ressourcenwörterbuchs
39 | //(wird verwendet, wenn eine Ressource auf der Seite, in der Anwendung oder einem
40 | // designspezifischen Ressourcenwörterbuch nicht gefunden werden kann.)
41 | )]
42 |
43 | // Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten:
44 | //
45 | // Hauptversion
46 | // Nebenversion
47 | // Buildnummer
48 | // Revision
49 | //
50 | // Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern
51 | // übernehmen, indem Sie "*" eingeben:
52 | // [assembly: AssemblyVersion("1.0.*")]
53 | [assembly: AssemblyVersion("1.0.0.0")]
54 | [assembly: AssemblyFileVersion("1.0.0.0")]
55 |
--------------------------------------------------------------------------------
/De.TorstenMandelkow.MetroChart/ChartControls/ChartLegendItem.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | #if NETFX_CORE
7 |
8 | using Windows.UI.Xaml;
9 | using Windows.UI.Xaml.Controls;
10 | using Windows.UI.Xaml.Media;
11 | using Windows.UI.Xaml.Media.Animation;
12 |
13 | #else
14 |
15 | using System.Windows.Controls;
16 | using System.Windows;
17 | using System.Windows.Media.Animation;
18 | using System.Windows.Media;
19 |
20 | #endif
21 |
22 | namespace De.TorstenMandelkow.MetroChart
23 | {
24 | public class ChartLegendItem : ContentControl
25 | {
26 | public static readonly DependencyProperty CaptionProperty =
27 | DependencyProperty.Register("Caption", typeof(string), typeof(ChartLegendItem),
28 | new PropertyMetadata(null));
29 | public static readonly DependencyProperty ValueProperty =
30 | DependencyProperty.Register("Value", typeof(double), typeof(ChartLegendItem),
31 | new PropertyMetadata(0.0));
32 | public static readonly DependencyProperty PercentageProperty =
33 | DependencyProperty.Register("Percentage", typeof(double), typeof(ChartLegendItem),
34 | new PropertyMetadata(null));
35 | public static readonly DependencyProperty ItemBrushProperty =
36 | DependencyProperty.Register("ItemBrush", typeof(Brush), typeof(ChartLegendItem),
37 | new PropertyMetadata(null));
38 |
39 | static ChartLegendItem()
40 | {
41 | #if NETFX_CORE
42 | //do nothing
43 | #elif SILVERLIGHT
44 | //do nothing
45 | #else
46 | DefaultStyleKeyProperty.OverrideMetadata(typeof(ChartLegendItem), new FrameworkPropertyMetadata(typeof(ChartLegendItem)));
47 | #endif
48 | }
49 |
50 | public ChartLegendItem()
51 | {
52 | #if NETFX_CORE
53 | this.DefaultStyleKey = typeof(ChartLegendItem);
54 | #elif SILVERLIGHT
55 | this.DefaultStyleKey = typeof(ChartLegendItem);
56 | #else
57 | //do nothing
58 | #endif
59 | }
60 |
61 | public string Caption
62 | {
63 | get { return (string)GetValue(CaptionProperty); }
64 | set { SetValue(CaptionProperty, value); }
65 | }
66 |
67 | public double Value
68 | {
69 | get { return (double)GetValue(ValueProperty); }
70 | set { SetValue(ValueProperty, value); }
71 | }
72 |
73 | public double Percentage
74 | {
75 | get { return (double)GetValue(PercentageProperty); }
76 | set { SetValue(PercentageProperty, value); }
77 | }
78 |
79 | public Brush ItemBrush
80 | {
81 | get { return (Brush)GetValue(ItemBrushProperty); }
82 | set { SetValue(ItemBrushProperty, value); }
83 | }
84 | }
85 | }
86 |
--------------------------------------------------------------------------------
/De.TorstenMandelkow.MetroChart/Core/PieChart/PieChart.cs:
--------------------------------------------------------------------------------
1 | namespace De.TorstenMandelkow.MetroChart
2 | {
3 | using System;
4 | using System.Collections.Generic;
5 | using System.Collections.Specialized;
6 | using System.Linq;
7 | using System.Text;
8 | using System.Windows;
9 |
10 | #if NETFX_CORE
11 | using Windows.UI.Xaml.Controls;
12 | using Windows.UI.Xaml.Media;
13 | using Windows.UI.Xaml.Shapes;
14 | using Windows.UI.Xaml.Markup;
15 | using Windows.UI.Xaml;
16 | using Windows.Foundation;
17 | using Windows.UI;
18 | using Windows.UI.Xaml.Media.Animation;
19 | using Windows.UI.Core;
20 | #else
21 | using System.Windows.Media;
22 | using System.Windows.Controls;
23 | using System.Windows.Data;
24 | #endif
25 |
26 | public class PieChart : ChartBase
27 | {
28 | #region Constructors
29 |
30 | ///
31 | /// Initializes the class.
32 | ///
33 | static PieChart()
34 | {
35 | #if NETFX_CORE
36 |
37 | #elif SILVERLIGHT
38 |
39 | #else
40 | DefaultStyleKeyProperty.OverrideMetadata(typeof(PieChart), new FrameworkPropertyMetadata(typeof(PieChart)));
41 | #endif
42 | }
43 |
44 | ///
45 | /// Initializes a new instance of the class.
46 | ///
47 | public PieChart()
48 | {
49 | #if NETFX_CORE
50 | this.DefaultStyleKey = typeof(PieChart);
51 | #endif
52 | #if SILVERLIGHT
53 | this.DefaultStyleKey = typeof(PieChart);
54 | #endif
55 |
56 | }
57 |
58 | #endregion Constructors
59 |
60 | protected override double GridLinesMaxValue
61 | {
62 | get
63 | {
64 | return 0.0;
65 | }
66 | }
67 |
68 | protected virtual bool IsDoughtnutEnabled
69 | {
70 | get
71 | {
72 | return false;
73 | }
74 | }
75 |
76 | public double PieMinimalSize
77 | {
78 | get { return (double)GetValue(PieMinimalSizeProperty); }
79 | set { SetValue(PieMinimalSizeProperty, value); }
80 | }
81 |
82 | public static readonly DependencyProperty PieMinimalSizeProperty =
83 | DependencyProperty.Register("PieMinimalSize",
84 | typeof(double), typeof(PieChart), new PropertyMetadata(250.0));
85 |
86 | public static readonly DependencyProperty InnerRadiusRatioProperty =
87 | DependencyProperty.Register("InnerRadiusRatio", typeof(double), typeof(PieChart),
88 | new PropertyMetadata(0.0));
89 |
90 | public double InnerRadiusRatio
91 | {
92 | get { return (double)GetValue(InnerRadiusRatioProperty); }
93 | set { SetValue(InnerRadiusRatioProperty, value); }
94 | }
95 |
96 |
97 | }
98 | }
--------------------------------------------------------------------------------
/TestApplication.Shared/Controls/StringToBrushConverter.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | #if NETFX_CORE
8 | using Windows.UI.Xaml.Data;
9 | using Windows.UI.Xaml;
10 | using Windows.UI.Xaml.Controls;
11 | using Windows.UI;
12 | using Windows.UI.Xaml.Media;
13 |
14 | #else
15 |
16 | using System.Windows;
17 | using System.Windows.Data;
18 | using System.Globalization;
19 | using System.Windows.Controls;
20 | using System.Windows.Media;
21 |
22 | #endif
23 |
24 | namespace TestApplication.Shared
25 | {
26 | public class StringToBrushConverter : IValueConverter
27 | {
28 | #if NETFX_CORE
29 |
30 | public object Convert(object value, Type targetType, object parameter, string language)
31 | {
32 | return InternalConvert(value, targetType, parameter);
33 | }
34 |
35 | public object ConvertBack(object value, Type targetType, object parameter, string language)
36 | {
37 | throw new NotImplementedException();
38 | }
39 |
40 | #else
41 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
42 | {
43 | return InternalConvert(value, targetType, parameter);
44 | }
45 |
46 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
47 | {
48 | throw new NotImplementedException();
49 | }
50 |
51 | #endif
52 |
53 | public object InternalConvert(object value, Type targetType, object parameter)
54 | {
55 | if (value == null)
56 | {
57 | return null;
58 | }
59 |
60 | string colorName = value.ToString();
61 | SolidColorBrush scb = new SolidColorBrush();
62 | switch (colorName as string)
63 | {
64 | case "Magenta":
65 | scb.Color = Colors.Magenta;
66 | return scb;
67 | case "Purple":
68 | scb.Color = Colors.Purple;
69 | return scb;
70 | case "Brown":
71 | scb.Color = Colors.Brown;
72 | return scb;
73 | case "Orange":
74 | scb.Color = Colors.Orange;
75 | return scb;
76 | case "Blue":
77 | scb.Color = Colors.Blue;
78 | return scb;
79 | case "Red":
80 | scb.Color = Colors.Red;
81 | return scb;
82 | case "Yellow":
83 | scb.Color = Colors.Yellow;
84 | return scb;
85 | case "Green":
86 | scb.Color = Colors.Green;
87 | return scb;
88 | default:
89 | return null;
90 | }
91 | }
92 | }
93 | }
94 |
--------------------------------------------------------------------------------
/De.TorstenMandelkow.MetroChart/ChartControls/PiePieceLabel.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | #if NETFX_CORE
7 |
8 | using Windows.UI.Xaml;
9 | using Windows.UI.Xaml.Controls;
10 | using Windows.UI.Xaml.Media;
11 | using Windows.UI.Xaml.Media.Animation;
12 |
13 | #else
14 |
15 | using System.Windows.Controls;
16 | using System.Windows;
17 | using System.Windows.Media.Animation;
18 | using System.Windows.Media;
19 |
20 | #endif
21 |
22 | namespace De.TorstenMandelkow.MetroChart
23 | {
24 | public class PiePieceLabel : Control
25 | {
26 | public static readonly DependencyProperty CaptionProperty =
27 | DependencyProperty.Register("Caption", typeof(string), typeof(PiePieceLabel),
28 | new PropertyMetadata(null));
29 | public static readonly DependencyProperty ValueProperty =
30 | DependencyProperty.Register("Value", typeof(double), typeof(PiePieceLabel),
31 | new PropertyMetadata(0.0, OnValueChanged));
32 |
33 | private static void OnValueChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
34 | {
35 |
36 | }
37 | public static readonly DependencyProperty PercentageProperty =
38 | DependencyProperty.Register("Percentage", typeof(double), typeof(PiePieceLabel),
39 | new PropertyMetadata(null));
40 | public static readonly DependencyProperty ItemBrushProperty =
41 | DependencyProperty.Register("ItemBrush", typeof(Brush), typeof(PiePieceLabel),
42 | new PropertyMetadata(null));
43 |
44 | static PiePieceLabel()
45 | {
46 | #if NETFX_CORE
47 | //do nothing
48 | #elif SILVERLIGHT
49 | //do nothing
50 | #else
51 | DefaultStyleKeyProperty.OverrideMetadata(typeof(PiePieceLabel), new FrameworkPropertyMetadata(typeof(PiePieceLabel)));
52 | #endif
53 | }
54 |
55 | public PiePieceLabel()
56 | {
57 | #if NETFX_CORE
58 | this.DefaultStyleKey = typeof(PiePieceLabel);
59 | #elif SILVERLIGHT
60 | this.DefaultStyleKey = typeof(PiePieceLabel);
61 | #else
62 | //do nothing
63 | #endif
64 | }
65 |
66 | public string Caption
67 | {
68 | get { return (string)GetValue(CaptionProperty); }
69 | set { SetValue(CaptionProperty, value); }
70 | }
71 |
72 | public double Value
73 | {
74 | get { return (double)GetValue(ValueProperty); }
75 | set { SetValue(ValueProperty, value); }
76 | }
77 |
78 | public double Percentage
79 | {
80 | get { return (double)GetValue(PercentageProperty); }
81 | set { SetValue(PercentageProperty, value); }
82 | }
83 |
84 | public Brush ItemBrush
85 | {
86 | get { return (Brush)GetValue(ItemBrushProperty); }
87 | set { SetValue(ItemBrushProperty, value); }
88 | }
89 | }
90 | }
91 |
--------------------------------------------------------------------------------
/TestApplication.Shared/Controls/PortableHyperlinkButton.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Diagnostics;
4 | using System.IO;
5 | using System.Linq;
6 | using System.Text;
7 | using System.Threading.Tasks;
8 |
9 | #if NETFX_CORE
10 |
11 | using Windows.Foundation;
12 | using Windows.Foundation.Collections;
13 | using Windows.UI.Xaml;
14 | using Windows.UI.Xaml.Controls;
15 | using Windows.UI.Xaml.Controls.Primitives;
16 | using Windows.UI.Xaml.Data;
17 | using Windows.UI.Xaml.Input;
18 | using Windows.UI.Xaml.Media;
19 | using Windows.UI.Xaml.Navigation;
20 | using Windows.UI.Xaml.Markup;
21 |
22 | #else
23 |
24 | using System.Reflection;
25 | using System.Text;
26 | using System.Windows;
27 | using System.Windows.Controls;
28 | using System.Windows.Media.Animation;
29 | using System.Windows.Navigation;
30 | using System.Windows.Threading;
31 | using System.Windows.Data;
32 | using System.Windows.Markup;
33 | using System.Xml;
34 |
35 | #endif
36 |
37 | #if SILVERLIGHT
38 | using System.Windows.Browser;
39 | #endif
40 | namespace TestApplication.Shared
41 | {
42 | public class PortableHyperLinkButton : Button
43 | {
44 | public static readonly DependencyProperty TextProperty =
45 | DependencyProperty.Register("Text", typeof(string), typeof(PortableHyperLinkButton),
46 | new PropertyMetadata(null));
47 |
48 | public static readonly DependencyProperty UrlProperty =
49 | DependencyProperty.Register("Url", typeof(string), typeof(PortableHyperLinkButton),
50 | new PropertyMetadata(null));
51 |
52 | public string Url
53 | {
54 | get { return (string)GetValue(UrlProperty); }
55 | set { SetValue(UrlProperty, value); }
56 | }
57 |
58 | public PortableHyperLinkButton()
59 | {
60 | this.Click += HyperLinkButton_Click;
61 |
62 | #if NETFX_CORE
63 | this.DefaultStyleKey = typeof(PortableHyperLinkButton);
64 | #elif SILVERLIGHT
65 | this.DefaultStyleKey = typeof(PortableHyperLinkButton);
66 | #else
67 |
68 | #endif
69 | }
70 |
71 | static PortableHyperLinkButton()
72 | {
73 | #if NETFX_CORE
74 |
75 | #elif SILVERLIGHT
76 |
77 | #else
78 | DefaultStyleKeyProperty.OverrideMetadata(typeof(PortableHyperLinkButton), new FrameworkPropertyMetadata(typeof(PortableHyperLinkButton)));
79 | #endif
80 | }
81 |
82 | void HyperLinkButton_Click(object sender, RoutedEventArgs e)
83 | {
84 | try
85 | {
86 | #if NETFX_CORE
87 | Windows.System.Launcher.LaunchUriAsync(new Uri(Url));
88 | #elif SILVERLIGHT
89 | HtmlPage.Window.Navigate(new Uri(Url), "_blank");
90 | #else
91 | Process.Start(Url);
92 | #endif
93 | }
94 | catch (Exception)
95 | {
96 | }
97 | }
98 | }
99 | }
100 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | ## Ignore Visual Studio temporary files, build results, and
2 | ## files generated by popular Visual Studio add-ons.
3 |
4 | # User-specific files
5 | *.suo
6 | *.user
7 | *.sln.docstates
8 |
9 | # Build results
10 |
11 | [Dd]ebug/
12 | [Rr]elease/
13 | x64/
14 | build/
15 | [Bb]in/
16 | [Oo]bj/
17 |
18 | # Enable "build/" folder in the NuGet Packages folder since NuGet packages use it for MSBuild targets
19 | !packages/*/build/
20 |
21 | # MSTest test Results
22 | [Tt]est[Rr]esult*/
23 | [Bb]uild[Ll]og.*
24 |
25 | *_i.c
26 | *_p.c
27 | *.ilk
28 | *.meta
29 | *.obj
30 | *.pch
31 | *.pdb
32 | *.pgc
33 | *.pgd
34 | *.rsp
35 | *.sbr
36 | *.tlb
37 | *.tli
38 | *.tlh
39 | *.tmp
40 | *.tmp_proj
41 | *.log
42 | *.vspscc
43 | *.vssscc
44 | .builds
45 | *.pidb
46 | *.log
47 | *.scc
48 |
49 | # Visual C++ cache files
50 | ipch/
51 | *.aps
52 | *.ncb
53 | *.opensdf
54 | *.sdf
55 | *.cachefile
56 |
57 | # Visual Studio profiler
58 | *.psess
59 | *.vsp
60 | *.vspx
61 |
62 | # Guidance Automation Toolkit
63 | *.gpState
64 |
65 | # ReSharper is a .NET coding add-in
66 | _ReSharper*/
67 | *.[Rr]e[Ss]harper
68 |
69 | # TeamCity is a build add-in
70 | _TeamCity*
71 |
72 | # DotCover is a Code Coverage Tool
73 | *.dotCover
74 |
75 | # NCrunch
76 | *.ncrunch*
77 | .*crunch*.local.xml
78 |
79 | # Installshield output folder
80 | [Ee]xpress/
81 |
82 | # DocProject is a documentation generator add-in
83 | DocProject/buildhelp/
84 | DocProject/Help/*.HxT
85 | DocProject/Help/*.HxC
86 | DocProject/Help/*.hhc
87 | DocProject/Help/*.hhk
88 | DocProject/Help/*.hhp
89 | DocProject/Help/Html2
90 | DocProject/Help/html
91 |
92 | # Click-Once directory
93 | publish/
94 |
95 | # Publish Web Output
96 | *.Publish.xml
97 |
98 | # NuGet Packages Directory
99 | ## TODO: If you have NuGet Package Restore enabled, uncomment the next line
100 | #packages/
101 |
102 | # Windows Azure Build Output
103 | csx
104 | *.build.csdef
105 |
106 | # Windows Store app package directory
107 | AppPackages/
108 |
109 | # Others
110 | sql/
111 | *.Cache
112 | ClientBin/
113 | [Ss]tyle[Cc]op.*
114 | ~$*
115 | *~
116 | *.dbmdl
117 | *.[Pp]ublish.xml
118 | *.pfx
119 | *.publishsettings
120 |
121 | # RIA/Silverlight projects
122 | Generated_Code/
123 |
124 | # Backup & report files from converting an old project file to a newer
125 | # Visual Studio version. Backup files are not needed, because we have git ;-)
126 | _UpgradeReport_Files/
127 | Backup*/
128 | UpgradeLog*.XML
129 | UpgradeLog*.htm
130 |
131 | # SQL Server files
132 | App_Data/*.mdf
133 | App_Data/*.ldf
134 |
135 |
136 | #LightSwitch generated files
137 | GeneratedArtifacts/
138 | _Pvt_Extensions/
139 | ModelManifest.xml
140 |
141 | # =========================
142 | # Windows detritus
143 | # =========================
144 |
145 | # Windows image file caches
146 | Thumbs.db
147 | ehthumbs.db
148 |
149 | # Folder config file
150 | Desktop.ini
151 |
152 | # Recycle Bin used on file shares
153 | $RECYCLE.BIN/
154 |
155 | # Mac desktop service store files
156 | .DS_Store
157 |
--------------------------------------------------------------------------------
/De.TorstenMandelkow.MetroChart/Converters/BooleanToVisibilityConverter.cs:
--------------------------------------------------------------------------------
1 | namespace De.TorstenMandelkow.MetroChart
2 | {
3 | using System;
4 | using System.Collections.Generic;
5 | using System.Linq;
6 | using System.Text;
7 |
8 | #if NETFX_CORE
9 | using Windows.UI.Xaml.Data;
10 | using Windows.UI.Xaml;
11 | #else
12 | using System.Windows.Controls;
13 | using System.Windows;
14 | using System.Windows.Data;
15 | #endif
16 |
17 | public sealed class BooleanToVisibilityConverter : IValueConverter
18 | {
19 |
20 | #if NETFX_CORE
21 |
22 | public object Convert(object value, Type targetType, object parameter, string language)
23 | {
24 | return InternalConvert(value, targetType, parameter);
25 | }
26 |
27 | public object ConvertBack(object value, Type targetType, object parameter, string language)
28 | {
29 | return InternalConvertBack(value, targetType, parameter);
30 | }
31 |
32 | #else
33 | public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
34 | {
35 | return InternalConvert(value, targetType, parameter);
36 | }
37 |
38 | public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
39 | {
40 | return InternalConvertBack(value, targetType, parameter);
41 | }
42 |
43 | #endif
44 |
45 | private object InternalConvert(object value, Type targetType, object parameter)
46 | {
47 | try
48 | {
49 | var flag = false;
50 | if (value is bool)
51 | {
52 | flag = (bool)value;
53 | }
54 | else if (value is bool?)
55 | {
56 | var nullable = (bool?)value;
57 | flag = nullable.GetValueOrDefault();
58 | }
59 | if (parameter != null)
60 | {
61 | if (bool.Parse((string)parameter))
62 | {
63 | flag = !flag;
64 | }
65 | }
66 | if (flag)
67 | {
68 | return Visibility.Visible;
69 | }
70 | else
71 | {
72 | return Visibility.Collapsed;
73 | }
74 | }
75 | catch (Exception ex)
76 | {
77 | }
78 | return Visibility.Collapsed;
79 | }
80 |
81 | public object InternalConvertBack(object value, Type targetType, object parameter)
82 | {
83 | var back = ((value is Visibility) && (((Visibility)value) == Visibility.Visible));
84 | if (parameter != null)
85 | {
86 | if ((bool)parameter)
87 | {
88 | back = !back;
89 | }
90 | }
91 | return back;
92 | }
93 | }
94 | }
95 |
--------------------------------------------------------------------------------
/TestApplicationSL.Web/TestApplicationSLTestPage.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | TestApplicationSL
6 |
20 |
21 |
57 |
58 |
59 |
72 |
73 |
74 |
--------------------------------------------------------------------------------
/De.TorstenMandelkow.MetroChart/ChartControls/ChartSeries.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections;
3 | namespace De.TorstenMandelkow.MetroChart
4 | {
5 | using System.Collections.Generic;
6 | using System.Collections.ObjectModel;
7 | using System.Linq;
8 | using System.Text;
9 | using System.Collections.Specialized;
10 |
11 | #if NETFX_CORE
12 | using Windows.UI.Xaml.Controls;
13 | using Windows.UI.Xaml.Media;
14 | using Windows.UI.Xaml.Shapes;
15 | using Windows.UI.Xaml.Markup;
16 | using Windows.UI.Xaml;
17 | using Windows.Foundation;
18 | using Windows.UI;
19 | using Windows.UI.Xaml.Media.Animation;
20 | using Windows.UI.Core;
21 | using Windows.UI.Xaml.Data;
22 |
23 | #else
24 | using System.Windows.Media;
25 | using System.Windows.Controls;
26 | using System.Windows;
27 | #endif
28 |
29 | public class ChartSeries : ItemsControl
30 | {
31 | public static readonly DependencyProperty BrushMemberProperty =
32 | DependencyProperty.Register("BrushMember",
33 | typeof(string),
34 | typeof(ChartSeries),
35 | new PropertyMetadata(null));
36 | public static readonly DependencyProperty DisplayMemberProperty =
37 | DependencyProperty.Register("DisplayMember",
38 | typeof(string),
39 | typeof(ChartSeries),
40 | new PropertyMetadata(null));
41 | public static readonly DependencyProperty ValueMemberProperty =
42 | DependencyProperty.Register("ValueMember",
43 | typeof(string),
44 | typeof(ChartSeries),
45 | new PropertyMetadata(null));
46 | public static readonly DependencyProperty SeriesTitleProperty =
47 | DependencyProperty.Register("SeriesTitle",
48 | typeof(string),
49 | typeof(ChartSeries),
50 | new PropertyMetadata(null));
51 |
52 | public ChartSeries()
53 | {
54 | }
55 |
56 | public string SeriesTitle
57 | {
58 | get
59 | {
60 | return (string)GetValue(SeriesTitleProperty);
61 | }
62 | set
63 | {
64 | SetValue(SeriesTitleProperty, value);
65 | }
66 | }
67 |
68 | public string DisplayMember
69 | {
70 | get
71 | {
72 | return (string)GetValue(DisplayMemberProperty);
73 | }
74 | set
75 | {
76 | SetValue(DisplayMemberProperty, value);
77 | }
78 | }
79 |
80 | public string ValueMember
81 | {
82 | get
83 | {
84 | return (string)GetValue(ValueMemberProperty);
85 | }
86 | set
87 | {
88 | SetValue(ValueMemberProperty, value);
89 | }
90 | }
91 |
92 | public string BrushMember
93 | {
94 | get { return (string)GetValue(BrushMemberProperty); }
95 | set { SetValue(BrushMemberProperty, value); }
96 | }
97 | }
98 | }
99 |
--------------------------------------------------------------------------------
/TestApplicationSL.Web/TestApplicationSLTestPage.aspx:
--------------------------------------------------------------------------------
1 | <%@ Page Language="C#" AutoEventWireup="true" %>
2 |
3 |
4 |
5 |
6 | TestApplicationSL
7 |
21 |
22 |
58 |
59 |
60 |
73 |
74 |
75 |
--------------------------------------------------------------------------------
/TestApplication.Shared/Controls/BooleanToVisibilityConverter.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | #if NETFX_CORE
8 |
9 | using Windows.UI.Xaml.Data;
10 | using Windows.UI.Xaml;
11 | using Windows.UI.Xaml.Controls;
12 |
13 | #else
14 |
15 | using System.Windows;
16 | using System.Windows.Data;
17 | using System.Globalization;
18 | using System.Windows.Controls;
19 |
20 | #endif
21 |
22 | namespace TestApplication.Shared
23 | {
24 | public sealed class BooleanToVisibilityConverter : IValueConverter
25 | {
26 |
27 | #if NETFX_CORE
28 |
29 | public object Convert(object value, Type targetType, object parameter, string language)
30 | {
31 | return InternalConvert(value, targetType, parameter);
32 | }
33 |
34 | public object ConvertBack(object value, Type targetType, object parameter, string language)
35 | {
36 | return InternalConvertBack(value, targetType, parameter);
37 | }
38 |
39 | #else
40 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
41 | {
42 | return InternalConvert(value, targetType, parameter);
43 | }
44 |
45 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
46 | {
47 | return InternalConvertBack(value, targetType, parameter);
48 | }
49 |
50 | #endif
51 |
52 | private object InternalConvert(object value, Type targetType, object parameter)
53 | {
54 | try
55 | {
56 | var flag = false;
57 | if (value is bool)
58 | {
59 | flag = (bool)value;
60 | }
61 | else if (value is bool?)
62 | {
63 | var nullable = (bool?)value;
64 | flag = nullable.GetValueOrDefault();
65 | }
66 | if (parameter != null)
67 | {
68 | if (bool.Parse((string)parameter))
69 | {
70 | flag = !flag;
71 | }
72 | }
73 | if (flag)
74 | {
75 | return Visibility.Visible;
76 | }
77 | else
78 | {
79 | return Visibility.Collapsed;
80 | }
81 | }
82 | catch (Exception ex)
83 | {
84 | }
85 | return Visibility.Collapsed;
86 | }
87 |
88 | public object InternalConvertBack(object value, Type targetType, object parameter)
89 | {
90 | var back = ((value is Visibility) && (((Visibility)value) == Visibility.Visible));
91 | if (parameter != null)
92 | {
93 | if ((bool)parameter)
94 | {
95 | back = !back;
96 | }
97 | }
98 | return back;
99 | }
100 | }
101 | }
102 |
--------------------------------------------------------------------------------
/De.TorstenMandelkow.MetroChart/ChartControls/PlotterArea.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | #if NETFX_CORE
7 |
8 | using Windows.UI.Xaml;
9 | using Windows.UI.Xaml.Controls;
10 | using Windows.UI.Xaml.Media;
11 | using Windows.UI.Xaml.Media.Animation;
12 |
13 | #else
14 |
15 | using System.Windows.Controls;
16 | using System.Windows;
17 | using System.Windows.Media.Animation;
18 | using System.Windows.Media;
19 |
20 | #endif
21 |
22 | namespace De.TorstenMandelkow.MetroChart
23 | {
24 | public class PlotterArea : ContentControl
25 | {
26 | public static readonly DependencyProperty DataPointItemTemplateProperty =
27 | DependencyProperty.Register("DataPointItemTemplate",
28 | typeof(DataTemplate),
29 | typeof(PlotterArea),
30 | new PropertyMetadata(null));
31 |
32 | public static readonly DependencyProperty DataPointItemsPanelProperty =
33 | DependencyProperty.Register("DataPointItemsPanel",
34 | typeof(ItemsPanelTemplate),
35 | typeof(PlotterArea),
36 | new PropertyMetadata(null));
37 |
38 | public static readonly DependencyProperty ChartLegendItemStyleProperty =
39 | DependencyProperty.Register("ChartLegendItemStyle",
40 | typeof(Style),
41 | typeof(PlotterArea),
42 | new PropertyMetadata(null));
43 |
44 | public static readonly DependencyProperty ParentChartProperty =
45 | DependencyProperty.Register("ParentChart",
46 | typeof(ChartBase),
47 | typeof(PlotterArea),
48 | new PropertyMetadata(null));
49 |
50 | static PlotterArea()
51 | {
52 | #if NETFX_CORE
53 | //do nothing
54 | #elif SILVERLIGHT
55 | //do nothing
56 | #else
57 | DefaultStyleKeyProperty.OverrideMetadata(typeof(PlotterArea), new FrameworkPropertyMetadata(typeof(PlotterArea)));
58 | #endif
59 | }
60 |
61 | public PlotterArea()
62 | {
63 | #if NETFX_CORE
64 | this.DefaultStyleKey = typeof(PlotterArea);
65 | #elif SILVERLIGHT
66 | this.DefaultStyleKey = typeof(PlotterArea);
67 | #else
68 | //do nothing
69 | #endif
70 |
71 | }
72 |
73 | public Style ChartLegendItemStyle
74 | {
75 | get { return (Style)GetValue(ChartLegendItemStyleProperty); }
76 | set { SetValue(ChartLegendItemStyleProperty, value); }
77 | }
78 |
79 | public DataTemplate DataPointItemTemplate
80 | {
81 | get { return (DataTemplate)GetValue(DataPointItemTemplateProperty); }
82 | set { SetValue(DataPointItemTemplateProperty, value); }
83 | }
84 |
85 | public ItemsPanelTemplate DataPointItemsPanel
86 | {
87 | get { return (ItemsPanelTemplate)GetValue(DataPointItemsPanelProperty); }
88 | set { SetValue(DataPointItemsPanelProperty, value); }
89 | }
90 |
91 | public ChartBase ParentChart
92 | {
93 | get { return (ChartBase)GetValue(ParentChartProperty); }
94 | set { SetValue(ParentChartProperty, value); }
95 | }
96 | }
97 | }
98 |
--------------------------------------------------------------------------------
/TestApplicationWPF/Properties/Resources.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // Dieser Code wurde von einem Tool generiert.
4 | // Laufzeitversion:4.0.30319.17626
5 | //
6 | // Änderungen an dieser Datei können fehlerhaftes Verhalten verursachen und gehen verloren, wenn
7 | // der Code neu generiert wird.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace TestApplicationWPF.Properties
12 | {
13 |
14 |
15 | ///
16 | /// Eine stark typisierte Ressourcenklasse zum Suchen von lokalisierten Zeichenfolgen usw.
17 | ///
18 | // Diese Klasse wurde von der StronglyTypedResourceBuilder-Klasse
19 | // über ein Tool wie ResGen oder Visual Studio automatisch generiert.
20 | // Um einen Member hinzuzufügen oder zu entfernen, bearbeiten Sie die .ResX-Datei und führen dann ResGen
21 | // mit der Option /str erneut aus, oder erstellen Sie Ihr VS-Projekt neu.
22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
25 | internal class Resources
26 | {
27 |
28 | private static global::System.Resources.ResourceManager resourceMan;
29 |
30 | private static global::System.Globalization.CultureInfo resourceCulture;
31 |
32 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
33 | internal Resources()
34 | {
35 | }
36 |
37 | ///
38 | /// Gibt die zwischengespeicherte ResourceManager-Instanz zurück, die von dieser Klasse verwendet wird.
39 | ///
40 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
41 | internal static global::System.Resources.ResourceManager ResourceManager
42 | {
43 | get
44 | {
45 | if ((resourceMan == null))
46 | {
47 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("TestApplicationWPF.Properties.Resources", typeof(Resources).Assembly);
48 | resourceMan = temp;
49 | }
50 | return resourceMan;
51 | }
52 | }
53 |
54 | ///
55 | /// Überschreibt die CurrentUICulture-Eigenschaft des aktuellen Threads für alle
56 | /// Ressourcenlookups, die diese stark typisierte Ressourcenklasse verwenden.
57 | ///
58 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
59 | internal static global::System.Globalization.CultureInfo Culture
60 | {
61 | get
62 | {
63 | return resourceCulture;
64 | }
65 | set
66 | {
67 | resourceCulture = value;
68 | }
69 | }
70 | }
71 | }
72 |
--------------------------------------------------------------------------------
/De.TorstenMandelkow.MetroChart/ChartControls/ChartArea.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections;
3 | namespace De.TorstenMandelkow.MetroChart
4 | {
5 | using System.Collections.Generic;
6 | using System.Collections.ObjectModel;
7 | using System.Linq;
8 | using System.Text;
9 | using System.Collections.Specialized;
10 |
11 | #if NETFX_CORE
12 | using Windows.UI.Xaml.Controls;
13 | using Windows.UI.Xaml.Media;
14 | using Windows.UI.Xaml.Shapes;
15 | using Windows.UI.Xaml.Markup;
16 | using Windows.UI.Xaml;
17 | using Windows.Foundation;
18 | using Windows.UI;
19 | using Windows.UI.Xaml.Media.Animation;
20 | using Windows.UI.Core;
21 | using Windows.UI.Xaml.Data;
22 |
23 | #else
24 | using System.Windows.Media;
25 | using System.Windows.Controls;
26 | using System.Windows;
27 | #endif
28 |
29 | public class ChartArea : ContentControl
30 | {
31 | static ChartArea()
32 | {
33 | #if NETFX_CORE
34 |
35 | #elif SILVERLIGHT
36 |
37 | #else
38 | DefaultStyleKeyProperty.OverrideMetadata(typeof(ChartArea), new FrameworkPropertyMetadata(typeof(ChartArea)));
39 | #endif
40 | }
41 |
42 | ///
43 | /// Initializes a new instance of the class.
44 | ///
45 | public ChartArea()
46 | {
47 | #if NETFX_CORE
48 | this.DefaultStyleKey = typeof(ChartArea);
49 | #endif
50 | #if SILVERLIGHT
51 | this.DefaultStyleKey = typeof(ChartArea);
52 | #endif
53 | }
54 |
55 | public static readonly DependencyProperty ParentChartProperty =
56 | DependencyProperty.Register("ParentChart",
57 | typeof(ChartBase),
58 | typeof(ChartArea),
59 | new PropertyMetadata(null));
60 | public static readonly DependencyProperty ChartLegendItemStyleProperty =
61 | DependencyProperty.Register("ChartLegendItemStyle",
62 | typeof(Style),
63 | typeof(ChartArea),
64 | new PropertyMetadata(null));
65 |
66 | public ChartBase ParentChart
67 | {
68 | get { return (ChartBase)GetValue(ParentChartProperty); }
69 | set { SetValue(ParentChartProperty, value); }
70 | }
71 |
72 | public ObservableCollection GridLines
73 | {
74 | get
75 | {
76 | return ParentChart.GridLines;
77 | }
78 | }
79 |
80 | public ObservableCollection DataPointGroups
81 | {
82 | get
83 | {
84 | return ParentChart.DataPointGroups;
85 | }
86 | }
87 |
88 | public ObservableCollection ChartLegendItems
89 | {
90 | get
91 | {
92 | return ParentChart.ChartLegendItems;
93 | }
94 | }
95 |
96 | public Style ChartLegendItemStyle
97 | {
98 | get { return (Style)GetValue(ChartLegendItemStyleProperty); }
99 | set { SetValue(ChartLegendItemStyleProperty, value); }
100 | }
101 | }
102 | }
103 |
--------------------------------------------------------------------------------
/De.TorstenMandelkow.MetroChart/Controls/FadingListView.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | #if NETFX_CORE
7 |
8 | using Windows.UI.Xaml;
9 | using Windows.UI.Xaml.Controls;
10 | using Windows.UI.Xaml.Media.Animation;
11 |
12 | #else
13 |
14 | using System.Windows.Controls;
15 | using System.Windows;
16 | using System.Windows.Media.Animation;
17 |
18 | #endif
19 |
20 | namespace De.TorstenMandelkow.MetroChart
21 | {
22 | public class FadingListView : ItemsControl
23 | {
24 | public static readonly DependencyProperty RealWidthProperty =
25 | DependencyProperty.Register("RealWidth", typeof(double), typeof(FadingListView),
26 | new PropertyMetadata(0.0));
27 | public static readonly DependencyProperty RealHeightProperty =
28 | DependencyProperty.Register("RealHeight", typeof(double), typeof(FadingListView),
29 | new PropertyMetadata(0.0));
30 |
31 | static FadingListView()
32 | {
33 | #if NETFX_CORE
34 | //do nothing
35 | #elif SILVERLIGHT
36 | //do nothing
37 | #else
38 | //DefaultStyleKeyProperty.OverrideMetadata(typeof(FadingListView), new FrameworkPropertyMetadata(typeof(FadingListView)));
39 | #endif
40 | }
41 |
42 | public FadingListView()
43 | {
44 | this.SizeChanged += FadingListView_SizeChanged;
45 | #if NETFX_CORE
46 | //this.DefaultStyleKey = typeof(FadingListView);
47 | #elif SILVERLIGHT
48 | //this.DefaultStyleKey = typeof(FadingListView);
49 | #else
50 | //do nothing
51 | #endif
52 |
53 | }
54 |
55 | public double RealWidth
56 | {
57 | get
58 | {
59 | return (double)GetValue(RealWidthProperty);
60 | }
61 | set
62 | {
63 | SetValue(RealWidthProperty, value);
64 | }
65 | }
66 |
67 | public double RealHeight
68 | {
69 | get
70 | {
71 | return (double)GetValue(RealHeightProperty);
72 | }
73 | set
74 | {
75 | SetValue(RealHeightProperty, value);
76 | }
77 | }
78 |
79 | void FadingListView_SizeChanged(object sender, SizeChangedEventArgs e)
80 | {
81 | RealWidth = this.ActualWidth;
82 | RealHeight = this.ActualHeight;
83 | }
84 |
85 | protected override void PrepareContainerForItemOverride(DependencyObject element, object item)
86 | {
87 | if (this.Items != null)
88 | {
89 | if (this.Items.Count < 100)
90 | {
91 | int index = this.ItemContainerGenerator.IndexFromContainer(element);
92 | var lb = (ContentPresenter)element;
93 |
94 | TimeSpan waitTime = TimeSpan.FromMilliseconds(index * (500.0 / this.Items.Count));
95 |
96 | lb.Opacity = 0.0;
97 | DoubleAnimation anm = new DoubleAnimation();
98 | anm.From = 0;
99 | anm.To = 1;
100 | anm.Duration = TimeSpan.FromMilliseconds(250);
101 | anm.BeginTime = waitTime;
102 |
103 | Storyboard storyda = new Storyboard();
104 | storyda.Children.Add(anm);
105 | Storyboard.SetTarget(storyda, lb);
106 | #if NETFX_CORE
107 | Storyboard.SetTargetProperty(storyda, "Opacity");
108 | #else
109 | Storyboard.SetTargetProperty(storyda, new PropertyPath(OpacityProperty));
110 | #endif
111 | storyda.Begin();
112 | }
113 | }
114 |
115 | base.PrepareContainerForItemOverride(element, item);
116 | }
117 | }
118 | }
119 |
--------------------------------------------------------------------------------
/TestApplication.Shared/TestApplication.Shared.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {BE0FB0DA-8BC0-4604-B865-F0DFC7E9FF10}
8 | Library
9 | Properties
10 | TestApplication.Shared
11 | TestApplication.Shared
12 | v4.5
13 | 512
14 | SAK
15 | SAK
16 | SAK
17 | SAK
18 |
19 |
20 | true
21 | full
22 | false
23 | bin\Debug\
24 | DEBUG;TRACE
25 | prompt
26 | 4
27 |
28 |
29 | pdbonly
30 | true
31 | bin\Release\
32 | TRACE
33 | prompt
34 | 4
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 | MSBuild:Compile
62 | Designer
63 |
64 |
65 |
66 |
67 | {4ab4b0db-780c-48b9-a642-8e527353d957}
68 | De.TorstenMandelkow.MetroChart.WPF
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
85 |
--------------------------------------------------------------------------------
/TestApplication.WinRT/App.xaml.cs:
--------------------------------------------------------------------------------
1 | using TestApplication.WinRT.Common;
2 |
3 | using System;
4 | using System.Collections.Generic;
5 | using System.IO;
6 | using System.Linq;
7 | using Windows.ApplicationModel;
8 | using Windows.ApplicationModel.Activation;
9 | using Windows.Foundation;
10 | using Windows.Foundation.Collections;
11 | using Windows.UI.Xaml;
12 | using Windows.UI.Xaml.Controls;
13 | using Windows.UI.Xaml.Controls.Primitives;
14 | using Windows.UI.Xaml.Data;
15 | using Windows.UI.Xaml.Input;
16 | using Windows.UI.Xaml.Media;
17 | using Windows.UI.Xaml.Navigation;
18 |
19 | // The Grid App template is documented at http://go.microsoft.com/fwlink/?LinkId=234226
20 |
21 | namespace TestApplication.WinRT
22 | {
23 | ///
24 | /// Stellt das anwendungsspezifische Verhalten bereit, um die Standardanwendungsklasse zu ergänzen.
25 | ///
26 | sealed partial class App : Application
27 | {
28 | ///
29 | /// Initializes the singleton Application object. This is the first line of authored code
30 | /// und daher das logische Äquivalent von main() bzw. WinMain().
31 | ///
32 | public App()
33 | {
34 | this.InitializeComponent();
35 | this.Suspending += OnSuspending;
36 | }
37 |
38 | ///
39 | /// Wird aufgerufen, wenn die Anwendung durch den Endbenutzer normal gestartet wird. Weitere Einstiegspunkte
40 | /// werden verwendet, wenn die Anwendung zum Öffnen einer bestimmten Datei, zum Anzeigen
41 | /// von Suchergebnissen usw. gestartet wird.
42 | ///
43 | /// Details über Startanforderung und -prozess.
44 | protected override async void OnLaunched(LaunchActivatedEventArgs args)
45 | {
46 | // Do not repeat app initialization when already running, just ensure that
47 | // the window is active
48 | if (args.PreviousExecutionState == ApplicationExecutionState.Running)
49 | {
50 | Window.Current.Activate();
51 | return;
52 | }
53 |
54 | // Create a Frame to act as the navigation context and associate it with
55 | // a SuspensionManager key
56 | var rootFrame = new Frame();
57 | SuspensionManager.RegisterFrame(rootFrame, "AppFrame");
58 |
59 | if (args.PreviousExecutionState == ApplicationExecutionState.Terminated)
60 | {
61 | // Restore the saved session state only when appropriate
62 | await SuspensionManager.RestoreAsync();
63 | }
64 |
65 | if (rootFrame.Content == null)
66 | {
67 | // When the navigation stack isn't restored navigate to the first page,
68 | // und konfigurieren Sie die neue Seite, indem Sie die erforderlichen Informationen als Navigationsparameter
69 | // übergeben.
70 | if (!rootFrame.Navigate(typeof(GroupDetailPage), "AllGroups"))
71 | {
72 | throw new Exception("Failed to create initial page");
73 | }
74 | }
75 |
76 | // Platzieren Sie den Rahmen im aktuellen Fenster, und stellen Sie sicher, dass er aktiv ist.
77 | Window.Current.Content = rootFrame;
78 | Window.Current.Activate();
79 | }
80 |
81 | ///
82 | /// Wird aufgerufen, wenn die Ausführung der Anwendung angehalten wird. Der Anwendungszustand wird gespeichert,
83 | /// ohne zu wissen, ob die Anwendung beendet oder fortgesetzt wird und die Speicherinhalte dabei
84 | /// unbeschädigt bleiben.
85 | ///
86 | /// Die Quelle der Anhalteanforderung.
87 | /// Details zur Anhalteanforderung.
88 | private async void OnSuspending(object sender, SuspendingEventArgs e)
89 | {
90 | var deferral = e.SuspendingOperation.GetDeferral();
91 | await SuspensionManager.SaveAsync();
92 | deferral.Complete();
93 | }
94 | }
95 | }
96 |
--------------------------------------------------------------------------------
/De.TorstenMandelkow.MetroChart/Core/DataPointGroup.cs:
--------------------------------------------------------------------------------
1 | namespace De.TorstenMandelkow.MetroChart
2 | {
3 | using System;
4 | using System.Collections.Generic;
5 | using System.ComponentModel;
6 | using System.Linq;
7 | using System.Text;
8 | using System.Reflection;
9 | using System.Collections.ObjectModel;
10 |
11 | #if NETFX_CORE
12 | using Windows.UI.Xaml.Controls;
13 | using Windows.UI.Xaml.Media;
14 | using Windows.UI.Xaml.Shapes;
15 | using Windows.UI.Xaml.Markup;
16 | using Windows.UI.Xaml;
17 | using Windows.Foundation;
18 | using Windows.UI;
19 | using Windows.UI.Xaml.Media.Animation;
20 | using Windows.UI.Core;
21 | #else
22 | using System.Windows.Media;
23 | using System.Windows.Controls;
24 | using System.Windows;
25 | #endif
26 |
27 | public class DataPointGroup : DependencyObject, INotifyPropertyChanged
28 | {
29 | public static readonly DependencyProperty SumOfDataPointGroupProperty =
30 | DependencyProperty.Register("SumOfDataPointGroup",
31 | typeof(double),
32 | typeof(DataPointGroup),
33 | new PropertyMetadata(0.0));
34 |
35 | public static readonly DependencyProperty SelectedItemProperty =
36 | DependencyProperty.Register("SelectedItem",
37 | typeof(object),
38 | typeof(DataPointGroup),
39 | new PropertyMetadata(null));
40 |
41 | public object SelectedItem
42 | {
43 | get { return (object)GetValue(SelectedItemProperty); }
44 | set { SetValue(SelectedItemProperty, value); }
45 | }
46 | public double SumOfDataPointGroup
47 | {
48 | get { return (double)GetValue(SumOfDataPointGroupProperty); }
49 | set { SetValue(SumOfDataPointGroupProperty, value); }
50 | }
51 |
52 | public ObservableCollection DataPoints
53 | { get; set; }
54 |
55 | public ChartBase ParentChart
56 | { get; private set; }
57 |
58 | public DataPointGroup(ChartBase parentChart, string caption, bool showcaption)
59 | {
60 | ParentChart = parentChart;
61 | Caption = caption;
62 | ShowCaption = showcaption;
63 |
64 | DataPoints = new ObservableCollection();
65 | DataPoints.CollectionChanged += Items_CollectionChanged;
66 | }
67 |
68 | void Items_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
69 | {
70 | foreach(var item in e.NewItems)
71 | {
72 | if (item is INotifyPropertyChanged)
73 | {
74 | (item as INotifyPropertyChanged).PropertyChanged += DataPointGroup_PropertyChanged;
75 | }
76 | }
77 | }
78 |
79 | void DataPointGroup_PropertyChanged(object sender, PropertyChangedEventArgs e)
80 | {
81 | if (e.PropertyName == "Value")
82 | {
83 | RecalcValues();
84 | }
85 | }
86 |
87 | private void RecalcValues()
88 | {
89 | double maxValue = 0.0;
90 | double sum = 0.0;
91 | foreach (var item in DataPoints)
92 | {
93 | item.StartValue = sum;
94 | sum += item.Value;
95 | if (item.Value > maxValue)
96 | {
97 | maxValue = item.Value;
98 | }
99 | }
100 | SumOfDataPointGroup = sum;
101 | RaisePropertyChangeEvent("SumOfDataPointGroup");
102 | }
103 |
104 | public string Caption { get; private set; }
105 |
106 | public bool ShowCaption { get; private set; }
107 |
108 | public event PropertyChangedEventHandler PropertyChanged;
109 |
110 | private void RaisePropertyChangeEvent(String propertyName)
111 | {
112 | if (PropertyChanged != null)
113 | this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
114 | }
115 | }
116 | }
117 |
--------------------------------------------------------------------------------
/De.TorstenMandelkow.MetroChart/Controls/EvenlyDistributedColumnsGrid.cs:
--------------------------------------------------------------------------------
1 | namespace De.TorstenMandelkow.MetroChart
2 | {
3 | using System;
4 | using System.Collections.Generic;
5 | using System.Linq;
6 | using System.Text;
7 |
8 | #if NETFX_CORE
9 | using Windows.UI.Xaml.Controls;
10 | using Windows.UI.Xaml.Media;
11 | using Windows.UI.Xaml.Shapes;
12 | using Windows.UI.Xaml.Markup;
13 | using Windows.UI.Xaml;
14 | using Windows.Foundation;
15 | using Windows.UI;
16 | using Windows.UI.Xaml.Media.Animation;
17 | using Windows.UI.Core;
18 | #else
19 | using System.Windows.Media;
20 | using System.Windows.Controls;
21 | using System.Windows;
22 | #endif
23 |
24 | public class EvenlyDistributedColumnsGrid : Panel
25 | {
26 | public EvenlyDistributedColumnsGrid()
27 | {
28 | // this.Background = new SolidColorBrush(Colors.Green);
29 | }
30 |
31 | protected override Size MeasureOverride(Size availableSize)
32 | {
33 | try
34 | {
35 | /*
36 | if (double.IsInfinity(availableSize.Width))
37 | {
38 | availableSize.Width = 1000;
39 | }
40 | if (double.IsInfinity(availableSize.Height))
41 | {
42 | availableSize.Height = 1000;
43 | }
44 | */
45 | //gleichmäßige Verteilung, deshalb suchen wir die breiteste Column und multiplizieren mit Anzahl der Spalten
46 | double maxColumnWidth = 0.0;
47 | double minColumnHeight = 0.0;
48 | foreach (UIElement child in Children)
49 | {
50 | if (Children.Count > 1)
51 | {
52 | }
53 | child.Measure(availableSize);
54 | if(maxColumnWidth < child.DesiredSize.Width)
55 | {
56 | maxColumnWidth = child.DesiredSize.Width;
57 | }
58 | if (minColumnHeight < child.DesiredSize.Height)
59 | {
60 | minColumnHeight = child.DesiredSize.Height;
61 | }
62 | }
63 | availableSize.Width = maxColumnWidth * Children.Count;
64 | availableSize.Height = minColumnHeight;
65 |
66 |
67 | /*
68 |
69 | Size cellSize = GetCellSize(internalAvailableSize);
70 |
71 | //is there any element which would exceed the cell width
72 | if (OneElementExceedsCellWidth(cellSize.Width))
73 | {
74 | //we switch to 2 rows, we need the order space for 2 rows
75 | double heightOfOneRow = GetHighestElement();
76 | return new Size(internalAvailableSize.Width, heightOfOneRow * 2);
77 | }
78 | * */
79 |
80 | return availableSize;
81 | }
82 | catch (Exception ex)
83 | {
84 | return new Size(0,0);
85 | }
86 | }
87 |
88 | private double GetHighestElement()
89 | {
90 | double highestElementHeight = 0.0;
91 | foreach (UIElement child in Children)
92 | {
93 | if (child.DesiredSize.Height > highestElementHeight)
94 | {
95 | highestElementHeight = child.DesiredSize.Height;
96 | }
97 | }
98 | return highestElementHeight;
99 | }
100 |
101 | private Size GetCellSize(Size availableSize)
102 | {
103 | return new Size(availableSize.Width / Children.Count, availableSize.Height);
104 | }
105 |
106 | protected override Size ArrangeOverride(Size finalSize)
107 | {
108 | //calculate the space for each column
109 | Size cellSize = GetCellSize(finalSize);
110 | double cellWidth = cellSize.Width;
111 | double cellHeight = cellSize.Height;
112 |
113 | int col = 0;
114 | foreach (UIElement child in Children)
115 | {
116 | double middlePointX = cellSize.Width * col + cellSize.Width / 2.0;
117 | child.Arrange(new Rect(new Point(middlePointX - cellWidth / 2.0, 0.0), new Size(cellWidth, cellHeight)));
118 | col++;
119 | }
120 | return finalSize;
121 | }
122 | }
123 | }
124 |
--------------------------------------------------------------------------------
/De.TorstenMandelkow.MetroChart/Core/ColumnChart/ColumnPiece.cs:
--------------------------------------------------------------------------------
1 | namespace De.TorstenMandelkow.MetroChart
2 | {
3 | using System;
4 | using System.Collections;
5 | using System.Collections.Generic;
6 | using System.ComponentModel;
7 | using System.Linq;
8 | using System.Text;
9 | using System.Windows;
10 | using System.Reflection;
11 | using System.Collections.Specialized;
12 | using System.Windows.Input;
13 |
14 | #if NETFX_CORE
15 | using Windows.UI.Xaml.Controls;
16 | using Windows.UI.Xaml.Media;
17 | using Windows.UI.Xaml.Shapes;
18 | using Windows.UI.Xaml.Markup;
19 | using Windows.UI.Xaml;
20 | using Windows.Foundation;
21 | using Windows.UI;
22 | using Windows.UI.Xaml.Media.Animation;
23 | using Windows.UI.Core;
24 | #else
25 | using System.Windows.Media;
26 | using System.Windows.Controls;
27 | using System.Windows.Media.Animation;
28 | using System.Windows.Shapes;
29 |
30 | #endif
31 |
32 | public class ColumnPiece : PieceBase
33 | {
34 | #region Fields
35 |
36 | private Border slice = null;
37 |
38 | public static readonly DependencyProperty PercentageProperty =
39 | DependencyProperty.Register("Percentage", typeof(double), typeof(ColumnPiece),
40 | new PropertyMetadata(0.0, new PropertyChangedCallback(OnPercentageChanged)));
41 |
42 | public static readonly DependencyProperty ColumnHeightProperty =
43 | DependencyProperty.Register("ColumnHeight", typeof(double), typeof(ColumnPiece),
44 | new PropertyMetadata(0.0));
45 |
46 | #endregion Fields
47 |
48 | #region Constructors
49 |
50 | static ColumnPiece()
51 | {
52 | #if NETFX_CORE
53 |
54 | #elif SILVERLIGHT
55 |
56 | #else
57 | DefaultStyleKeyProperty.OverrideMetadata(typeof(ColumnPiece), new FrameworkPropertyMetadata(typeof(ColumnPiece)));
58 | #endif
59 | }
60 |
61 | ///
62 | /// Initializes a new instance of the class.
63 | ///
64 | public ColumnPiece()
65 | {
66 | #if NETFX_CORE
67 | this.DefaultStyleKey = typeof(ColumnPiece);
68 | #endif
69 | #if SILVERLIGHT
70 | this.DefaultStyleKey = typeof(ColumnPiece);
71 | #endif
72 | Loaded += ColumnPiece_Loaded;
73 | }
74 |
75 | #endregion Constructors
76 |
77 | #region Properties
78 |
79 | public double Percentage
80 | {
81 | get { return (double)GetValue(PercentageProperty); }
82 | set { SetValue(PercentageProperty, value); }
83 | }
84 |
85 | public double ColumnHeight
86 | {
87 | get { return (double)GetValue(ColumnHeightProperty); }
88 | set { SetValue(ColumnHeightProperty, value); }
89 | }
90 |
91 | #endregion Properties
92 |
93 | #region Methods
94 |
95 | private static void OnPercentageChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
96 | {
97 | (d as ColumnPiece).DrawGeometry();
98 | }
99 |
100 | protected override void InternalOnApplyTemplate()
101 | {
102 | slice = this.GetTemplateChild("Slice") as Border;
103 | RegisterMouseEvents(slice);
104 | }
105 |
106 | void ColumnPiece_Loaded(object sender, RoutedEventArgs e)
107 | {
108 | DrawGeometry();
109 | }
110 |
111 | protected override void DrawGeometry(bool withAnimation = true)
112 | {
113 | try
114 | {
115 | if (this.ClientWidth <= 0.0)
116 | {
117 | return;
118 | }
119 | if (this.ClientHeight <= 0.0)
120 | {
121 | return;
122 | }
123 |
124 | double startHeight = 0;
125 | if (slice.Height > 0)
126 | {
127 | startHeight = slice.Height;
128 | }
129 |
130 | DoubleAnimation scaleAnimation = new DoubleAnimation();
131 | scaleAnimation.From = startHeight;
132 | scaleAnimation.To = this.ClientHeight * Percentage;
133 | scaleAnimation.Duration = TimeSpan.FromMilliseconds(withAnimation ? 500: 0);
134 | scaleAnimation.EasingFunction = new QuarticEase() { EasingMode = EasingMode.EaseOut };
135 | Storyboard storyScaleX = new Storyboard();
136 | storyScaleX.Children.Add(scaleAnimation);
137 |
138 | Storyboard.SetTarget(storyScaleX, slice);
139 |
140 | #if NETFX_CORE
141 | scaleAnimation.EnableDependentAnimation = true;
142 | Storyboard.SetTargetProperty(storyScaleX, "Height");
143 | #else
144 | Storyboard.SetTargetProperty(storyScaleX, new PropertyPath("Height"));
145 | #endif
146 | storyScaleX.Begin();
147 |
148 | }
149 | catch (Exception ex)
150 | {
151 | }
152 | }
153 |
154 | #endregion Methods
155 | }
156 | }
--------------------------------------------------------------------------------
/De.TorstenMandelkow.MetroChart/Controls/EvenlyDistributedRowGrid.cs:
--------------------------------------------------------------------------------
1 | namespace De.TorstenMandelkow.MetroChart
2 | {
3 | using System;
4 | using System.Collections.Generic;
5 | using System.Linq;
6 | using System.Text;
7 |
8 | #if NETFX_CORE
9 | using Windows.UI.Xaml.Controls;
10 | using Windows.UI.Xaml.Media;
11 | using Windows.UI.Xaml.Shapes;
12 | using Windows.UI.Xaml.Markup;
13 | using Windows.UI.Xaml;
14 | using Windows.Foundation;
15 | using Windows.UI;
16 | using Windows.UI.Xaml.Media.Animation;
17 | using Windows.UI.Core;
18 | #else
19 | using System.Windows.Media;
20 | using System.Windows.Controls;
21 | using System.Windows;
22 | #endif
23 |
24 | public class EvenlyDistributedRowGrid : Panel
25 | {
26 | public EvenlyDistributedRowGrid()
27 | {
28 | // this.Background = new SolidColorBrush(Colors.Green);
29 | }
30 |
31 | public static readonly DependencyProperty IsReverseOrderProperty =
32 | DependencyProperty.Register("IsReverseOrder",
33 | typeof(bool),
34 | typeof(EvenlyDistributedRowGrid),
35 | new PropertyMetadata(false));
36 |
37 | public bool IsReverseOrder
38 | {
39 | get { return (bool)GetValue(IsReverseOrderProperty); }
40 | set { SetValue(IsReverseOrderProperty, value); }
41 | }
42 |
43 | protected override Size MeasureOverride(Size availableSize)
44 | {
45 | Size returnedSize = availableSize;
46 |
47 | if (double.IsInfinity(availableSize.Height))
48 | {
49 | // ok, we have all the space we need, so we take it
50 | double maxColumnWidth = 0.0;
51 | double minColumnHeight = 0.0;
52 | foreach (UIElement child in Children)
53 | {
54 | child.Measure(availableSize);
55 | if (maxColumnWidth < child.DesiredSize.Width)
56 | {
57 | maxColumnWidth = child.DesiredSize.Width;
58 | }
59 | if (minColumnHeight < child.DesiredSize.Height)
60 | {
61 | minColumnHeight = child.DesiredSize.Height;
62 | }
63 | }
64 |
65 | returnedSize.Width = maxColumnWidth;
66 | returnedSize.Height = minColumnHeight * Children.Count;
67 | return returnedSize;
68 | }
69 | else
70 | {
71 | // oh no, the height is limited, so we can only take this height
72 | double spaceForHeight = availableSize.Height / Children.Count;
73 |
74 | double maxColumnWidth = 0.0;
75 | double minColumnHeight = 0.0;
76 | foreach (UIElement child in Children)
77 | {
78 | child.Measure(new Size(availableSize.Width, spaceForHeight));
79 | if (maxColumnWidth < child.DesiredSize.Width)
80 | {
81 | maxColumnWidth = child.DesiredSize.Width;
82 | }
83 | if (minColumnHeight < child.DesiredSize.Height)
84 | {
85 | minColumnHeight = child.DesiredSize.Height;
86 | }
87 | }
88 |
89 | returnedSize.Width = maxColumnWidth;
90 | returnedSize.Height = minColumnHeight * Children.Count;
91 | return returnedSize;
92 | }
93 | }
94 |
95 | private double GetLargestElementWidth(Size availableSize)
96 | {
97 | double minimalWidth = 0.0;
98 | foreach (UIElement child in Children)
99 | {
100 | child.Measure(availableSize);
101 | if (child.DesiredSize.Width > minimalWidth)
102 | {
103 | minimalWidth = child.DesiredSize.Width;
104 | }
105 | }
106 | return minimalWidth;
107 | }
108 |
109 | protected override Size ArrangeOverride(Size finalSize)
110 | {
111 | Size cellSize = new Size(finalSize.Width, finalSize.Height / Children.Count);
112 | int row = 0, col = 0;
113 | double reverseStartPoint = finalSize.Height - cellSize.Height;
114 | foreach (UIElement child in Children)
115 | {
116 | if (IsReverseOrder)
117 | {
118 | child.Arrange(new Rect(new Point(cellSize.Width * col, reverseStartPoint - cellSize.Height * row), cellSize));
119 | }
120 | else
121 | {
122 | child.Arrange(new Rect(new Point(cellSize.Width * col, cellSize.Height * row), cellSize));
123 | }
124 | row++;
125 | }
126 |
127 | /*
128 | if (minimalWidth > 0.0)
129 | {
130 | if (this.Width != minimalWidth)
131 | {
132 | this.Width = minimalWidth;
133 | }
134 | }
135 | */
136 |
137 | return new Size(finalSize.Width, finalSize.Height);
138 | }
139 | }
140 | }
141 |
--------------------------------------------------------------------------------
/De.TorstenMandelkow.MetroChart/Core/BarChart/BarPiece.cs:
--------------------------------------------------------------------------------
1 | namespace De.TorstenMandelkow.MetroChart
2 | {
3 | using System;
4 | using System.Collections;
5 | using System.Collections.Generic;
6 | using System.ComponentModel;
7 | using System.Linq;
8 | using System.Text;
9 | using System.Windows;
10 | using System.Reflection;
11 | using System.Collections.Specialized;
12 | using System.Windows.Input;
13 |
14 | #if NETFX_CORE
15 | using Windows.UI.Xaml.Controls;
16 | using Windows.UI.Xaml.Media;
17 | using Windows.UI.Xaml.Shapes;
18 | using Windows.UI.Xaml.Markup;
19 | using Windows.UI.Xaml;
20 | using Windows.Foundation;
21 | using Windows.UI;
22 | using Windows.UI.Xaml.Media.Animation;
23 | using Windows.UI.Core;
24 | #else
25 | using System.Windows.Media;
26 | using System.Windows.Controls;
27 | using System.Windows.Media.Animation;
28 | using System.Windows.Shapes;
29 |
30 | #endif
31 |
32 | public class BarPiece : PieceBase
33 | {
34 | #region Fields
35 |
36 | private Border slice = null;
37 |
38 | public static readonly DependencyProperty PercentageProperty =
39 | DependencyProperty.Register("Percentage", typeof(double), typeof(BarPiece),
40 | new PropertyMetadata(0.0, new PropertyChangedCallback(OnPercentageChanged)));
41 |
42 | public static readonly DependencyProperty ColumnWidthProperty =
43 | DependencyProperty.Register("ColumnWidth", typeof(double), typeof(BarPiece),
44 | new PropertyMetadata(0.0));
45 |
46 | #endregion Fields
47 |
48 | #region Constructors
49 |
50 | static BarPiece()
51 | {
52 | #if NETFX_CORE
53 |
54 | #elif SILVERLIGHT
55 |
56 | #else
57 | DefaultStyleKeyProperty.OverrideMetadata(typeof(BarPiece), new FrameworkPropertyMetadata(typeof(BarPiece)));
58 | #endif
59 | }
60 |
61 | ///
62 | /// Initializes a new instance of the class.
63 | ///
64 | public BarPiece()
65 | {
66 | #if NETFX_CORE
67 | this.DefaultStyleKey = typeof(BarPiece);
68 | #endif
69 | #if SILVERLIGHT
70 | this.DefaultStyleKey = typeof(BarPiece);
71 | #endif
72 | Loaded += ColumnPiece_Loaded;
73 | }
74 |
75 | #endregion Constructors
76 |
77 | #region Properties
78 |
79 | public double Percentage
80 | {
81 | get { return (double)GetValue(PercentageProperty); }
82 | set { SetValue(PercentageProperty, value); }
83 | }
84 |
85 | public double ColumnWidth
86 | {
87 | get { return (double)GetValue(ColumnWidthProperty); }
88 | set { SetValue(ColumnWidthProperty, value); }
89 | }
90 |
91 | #endregion Properties
92 |
93 | #region Methods
94 |
95 | private static void OnPercentageChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
96 | {
97 | (d as BarPiece).DrawGeometry();
98 | }
99 |
100 | protected override void InternalOnApplyTemplate()
101 | {
102 | slice = this.GetTemplateChild("Slice") as Border;
103 | RegisterMouseEvents(slice);
104 | }
105 |
106 | void ColumnPiece_Loaded(object sender, RoutedEventArgs e)
107 | {
108 | DrawGeometry();
109 | }
110 |
111 | ///
112 | /// Draws the geometry.
113 | ///
114 | /// The context.
115 | protected override void DrawGeometry(bool withAnimation = true)
116 | {
117 | try
118 | {
119 | if (this.ClientWidth <= 0.0)
120 | {
121 | return;
122 | }
123 | if (this.ClientHeight <= 0.0)
124 | {
125 | return;
126 | }
127 |
128 | double startWidth = 0;
129 | if (slice.Width > 0)
130 | {
131 | startWidth = slice.Width;
132 | }
133 |
134 | DoubleAnimation scaleAnimation = new DoubleAnimation();
135 | scaleAnimation.From = startWidth;
136 | scaleAnimation.To = this.ClientWidth * Percentage;
137 | scaleAnimation.Duration = TimeSpan.FromMilliseconds(500);
138 | scaleAnimation.EasingFunction = new QuarticEase() { EasingMode = EasingMode.EaseOut };
139 | Storyboard storyScaleX = new Storyboard();
140 | storyScaleX.Children.Add(scaleAnimation);
141 |
142 | Storyboard.SetTarget(storyScaleX, slice);
143 |
144 | #if NETFX_CORE
145 | scaleAnimation.EnableDependentAnimation = true;
146 | Storyboard.SetTargetProperty(storyScaleX, "Width");
147 | #else
148 | Storyboard.SetTargetProperty(storyScaleX, new PropertyPath("Width"));
149 | #endif
150 | storyScaleX.Begin();
151 |
152 | //SetValue(ColumnPiece.ColumnHeightProperty, this.ClientHeight * Percentage);
153 | }
154 | catch (Exception ex)
155 | {
156 | }
157 | }
158 |
159 | #endregion Methods
160 | }
161 | }
--------------------------------------------------------------------------------
/De.TorstenMandelkow.MetroChart/De.TorstenMandelkow.MetroChart.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {FA286411-E476-4BD0-ABE9-7AE69226069C}
8 | Library
9 | Properties
10 | De.TorstenMandelkow.MetroChart
11 | De.TorstenMandelkow.MetroChart
12 | v4.5
13 | 512
14 | SAK
15 | SAK
16 | SAK
17 | SAK
18 |
19 |
20 | true
21 | full
22 | false
23 | bin\Debug\
24 | DEBUG;TRACE
25 | prompt
26 | 4
27 |
28 |
29 | pdbonly
30 | true
31 | bin\Release\
32 | TRACE
33 | prompt
34 | 4
35 |
36 |
37 | true
38 | ..\MainKey.snk
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 | MSBuild:Compile
98 | Designer
99 |
100 |
101 |
102 |
109 |
--------------------------------------------------------------------------------
/TestApplicationSL.Web/TestApplicationSL.Web.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 |
8 |
9 | 2.0
10 | {6C68FA92-873E-485E-8019-0B5EA7567CF7}
11 | {349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}
12 | Library
13 | Properties
14 | TestApplicationSL.Web
15 | TestApplicationSL.Web
16 | v4.5
17 | true
18 |
19 |
20 |
21 |
22 | {8F0A4417-85C6-4545-B9B2-5FF99035E369}|..\TestApplicationSL\TestApplicationSL.csproj|ClientBin|False
23 | SAK
24 | SAK
25 | SAK
26 | SAK
27 |
28 |
29 | true
30 | full
31 | false
32 | bin\
33 | DEBUG;TRACE
34 | prompt
35 | 4
36 |
37 |
38 | pdbonly
39 | true
40 | bin\
41 | TRACE
42 | prompt
43 | 4
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 | Web.config
77 |
78 |
79 |
80 |
81 | Web.config
82 |
83 |
84 |
85 |
86 | 10.0
87 | $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 | True
97 | True
98 | 0
99 | /
100 | http://localhost:59119/
101 | False
102 | False
103 |
104 |
105 | False
106 |
107 |
108 |
109 |
110 |
117 |
--------------------------------------------------------------------------------
/De.TorstenMandelkow.MetroChart/Controls/CustomWrapPanel.cs:
--------------------------------------------------------------------------------
1 | namespace De.TorstenMandelkow.MetroChart
2 | {
3 | using System;
4 | using System.Collections.Generic;
5 | using System.Linq;
6 | using System.Text;
7 |
8 | #if NETFX_CORE
9 | using Windows.UI.Xaml.Controls;
10 | using Windows.UI.Xaml.Media;
11 | using Windows.UI.Xaml.Shapes;
12 | using Windows.UI.Xaml.Markup;
13 | using Windows.UI.Xaml;
14 | using Windows.Foundation;
15 | using Windows.UI;
16 | using Windows.UI.Xaml.Media.Animation;
17 | using Windows.UI.Core;
18 | #else
19 | using System.Windows.Media;
20 | using System.Windows.Controls;
21 | using System.Windows;
22 | #endif
23 |
24 | public class CustomWrapPanel : Panel
25 | {
26 | public Orientation Orientation
27 | {
28 | get { return (Orientation)GetValue(OrientationProperty); }
29 | set { SetValue(OrientationProperty, value); }
30 | }
31 |
32 | public static readonly DependencyProperty OrientationProperty =
33 | DependencyProperty.Register("Orientation",
34 | typeof(Orientation), typeof(CustomWrapPanel), null);
35 |
36 | public CustomWrapPanel()
37 | {
38 | Orientation = Orientation.Horizontal;
39 | }
40 |
41 | protected override Size MeasureOverride(Size availableSize)
42 | {
43 | double minWidth = 0.0;
44 | foreach (UIElement child in Children)
45 | {
46 | child.Measure(new Size(availableSize.Width, availableSize.Height));
47 | if (minWidth < child.DesiredSize.Width)
48 | {
49 | minWidth = child.DesiredSize.Width;
50 | }
51 | }
52 | return new Size(minWidth, 0);
53 | }
54 |
55 | protected override Size ArrangeOverride(Size finalSize)
56 | {
57 | if (Children.Count > 0)
58 | {
59 | Size z = SimpleArrange(finalSize.Width, finalSize.Height);
60 | if(base.Height != z.Height)
61 | {
62 | base.Height = z.Height;
63 | }
64 | return z;
65 | }
66 | return new Size(0, 0);
67 | }
68 |
69 | private Size SimpleArrange(double availableWidth, double availableHeight)
70 | {
71 | Point point = new Point(0, 0);
72 | int i = 0;
73 | int columnCount = 0;
74 |
75 | if (Orientation == Orientation.Vertical)
76 | {
77 | double largestItemWidth = 0.0;
78 | double finalWidth = 0.0;
79 |
80 | foreach (UIElement child in Children)
81 | {
82 | child.Arrange(new Rect(point, new Point(point.X + child.DesiredSize.Width, point.Y + child.DesiredSize.Height)));
83 | finalWidth = point.X + child.DesiredSize.Width;
84 |
85 | if (child.DesiredSize.Width > largestItemWidth)
86 | {
87 | largestItemWidth = child.DesiredSize.Width;
88 | }
89 |
90 | point.Y = point.Y + child.DesiredSize.Height;
91 |
92 | if ((i + 1) < Children.Count)
93 | {
94 | if ((point.Y + Children[i + 1].DesiredSize.Height) > availableHeight)
95 | {
96 | point.Y = 0;
97 | point.X = point.X + largestItemWidth;
98 | largestItemWidth = 0.0;
99 | columnCount++;
100 | }
101 | }
102 | i++;
103 |
104 | }
105 |
106 | return new Size(finalWidth, availableHeight);
107 | }
108 | else
109 | {
110 | double largestItemHeight = 0.0;
111 | double finalHeight = 0.0;
112 | double largestWidth = 0.0;
113 |
114 | foreach (UIElement child in Children)
115 | {
116 | child.Arrange(new Rect(point, new Point(point.X + child.DesiredSize.Width, point.Y + child.DesiredSize.Height)));
117 |
118 | finalHeight = point.Y + child.DesiredSize.Height;
119 | if (largestWidth < point.X + child.DesiredSize.Width)
120 | {
121 | largestWidth = point.X + child.DesiredSize.Width;
122 | }
123 |
124 | if (child.DesiredSize.Height > largestItemHeight)
125 | {
126 | largestItemHeight = child.DesiredSize.Height;
127 | }
128 |
129 | point.X = point.X + child.DesiredSize.Width;
130 |
131 | if ((i + 1) < Children.Count)
132 | {
133 | if ((point.X + Children[i + 1].DesiredSize.Width) > availableWidth)
134 | {
135 | point.X = 0;
136 | point.Y = point.Y + largestItemHeight;
137 | largestItemHeight = 0.0;
138 | }
139 | }
140 | i++;
141 |
142 | }
143 |
144 | //return new Size(largestWidth, finalHeight);
145 | return new Size(availableWidth, finalHeight);
146 | }
147 | }
148 | }
149 | }
150 |
151 |
--------------------------------------------------------------------------------
/TestApplicationWPF/Properties/Resources.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 | text/microsoft-resx
107 |
108 |
109 | 2.0
110 |
111 |
112 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
113 |
114 |
115 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
--------------------------------------------------------------------------------
/TestApplicationSL.Web/Silverlight.js:
--------------------------------------------------------------------------------
1 | //v2.0.30511.0
2 | if(!window.Silverlight)window.Silverlight={};Silverlight._silverlightCount=0;Silverlight.__onSilverlightInstalledCalled=false;Silverlight.fwlinkRoot="http://go2.microsoft.com/fwlink/?LinkID=";Silverlight.__installationEventFired=false;Silverlight.onGetSilverlight=null;Silverlight.onSilverlightInstalled=function(){window.location.reload(false)};Silverlight.isInstalled=function(b){if(b==undefined)b=null;var a=false,m=null;try{var i=null,j=false;if(window.ActiveXObject)try{i=new ActiveXObject("AgControl.AgControl");if(b===null)a=true;else if(i.IsVersionSupported(b))a=true;i=null}catch(l){j=true}else j=true;if(j){var k=navigator.plugins["Silverlight Plug-In"];if(k)if(b===null)a=true;else{var h=k.description;if(h==="1.0.30226.2")h="2.0.30226.2";var c=h.split(".");while(c.length>3)c.pop();while(c.length<4)c.push(0);var e=b.split(".");while(e.length>4)e.pop();var d,g,f=0;do{d=parseInt(e[f]);g=parseInt(c[f]);f++}while(f");delete a.id;delete a.width;delete a.height;for(var c in a)if(a[c])b.push('');b.push("");return b.join("")};Silverlight.createObjectEx=function(b){var a=b,c=Silverlight.createObject(a.source,a.parentElement,a.id,a.properties,a.events,a.initParams,a.context);if(a.parentElement==null)return c};Silverlight.buildPromptHTML=function(b){var a="",d=Silverlight.fwlinkRoot,c=b.version;if(b.alt)a=b.alt;else{if(!c)c="";a="
";a=a.replace("{1}",c);a=a.replace("{2}",d+"108181")}return a};Silverlight.getSilverlight=function(e){if(Silverlight.onGetSilverlight)Silverlight.onGetSilverlight();var b="",a=String(e).split(".");if(a.length>1){var c=parseInt(a[0]);if(isNaN(c)||c<2)b="1.0";else b=a[0]+"."+a[1]}var d="";if(b.match(/^\d+\056\d+$/))d="&v="+b;Silverlight.followFWLink("149156"+d)};Silverlight.followFWLink=function(a){top.location=Silverlight.fwlinkRoot+String(a)};Silverlight.HtmlAttributeEncode=function(c){var a,b="";if(c==null)return null;for(var d=0;d96&&a<123||a>64&&a<91||a>43&&a<58&&a!=47||a==95)b=b+String.fromCharCode(a);else b=b+""+a+";"}return b};Silverlight.default_error_handler=function(e,b){var d,c=b.ErrorType;d=b.ErrorCode;var a="\nSilverlight error message \n";a+="ErrorCode: "+d+"\n";a+="ErrorType: "+c+" \n";a+="Message: "+b.ErrorMessage+" \n";if(c=="ParserError"){a+="XamlFile: "+b.xamlFile+" \n";a+="Line: "+b.lineNumber+" \n";a+="Position: "+b.charPosition+" \n"}else if(c=="RuntimeError"){if(b.lineNumber!=0){a+="Line: "+b.lineNumber+" \n";a+="Position: "+b.charPosition+" \n"}a+="MethodName: "+b.methodName+" \n"}alert(a)};Silverlight.__cleanup=function(){for(var a=Silverlight._silverlightCount-1;a>=0;a--)window["__slEvent"+a]=null;Silverlight._silverlightCount=0;if(window.removeEventListener)window.removeEventListener("unload",Silverlight.__cleanup,false);else window.detachEvent("onunload",Silverlight.__cleanup)};Silverlight.__getHandlerName=function(b){var a="";if(typeof b=="string")a=b;else if(typeof b=="function"){if(Silverlight._silverlightCount==0)if(window.addEventListener)window.addEventListener("onunload",Silverlight.__cleanup,false);else window.attachEvent("onunload",Silverlight.__cleanup);var c=Silverlight._silverlightCount++;a="__slEvent"+c;window[a]=b}else a=null;return a};Silverlight.onRequiredVersionAvailable=function(){};Silverlight.onRestartRequired=function(){};Silverlight.onUpgradeRequired=function(){};Silverlight.onInstallRequired=function(){};Silverlight.IsVersionAvailableOnError=function(d,a){var b=false;try{if(a.ErrorCode==8001&&!Silverlight.__installationEventFired){Silverlight.onUpgradeRequired();Silverlight.__installationEventFired=true}else if(a.ErrorCode==8002&&!Silverlight.__installationEventFired){Silverlight.onRestartRequired();Silverlight.__installationEventFired=true}else if(a.ErrorCode==5014||a.ErrorCode==2106){if(Silverlight.__verifySilverlight2UpgradeSuccess(a.getHost()))b=true}else b=true}catch(c){}return b};Silverlight.IsVersionAvailableOnLoad=function(b){var a=false;try{if(Silverlight.__verifySilverlight2UpgradeSuccess(b.getHost()))a=true}catch(c){}return a};Silverlight.__verifySilverlight2UpgradeSuccess=function(d){var c=false,b="2.0.31005",a=null;try{if(d.IsVersionSupported(b+".99")){a=Silverlight.onRequiredVersionAvailable;c=true}else if(d.IsVersionSupported(b+".0"))a=Silverlight.onRestartRequired;else a=Silverlight.onUpgradeRequired;if(a&&!Silverlight.__installationEventFired){a();Silverlight.__installationEventFired=true}}catch(e){}return c}
--------------------------------------------------------------------------------
/XAMLReplace.targets:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | $(MarkupCompilePass1DependsOn)
7 | PreprocessXaml;
8 |
9 |
10 |
11 | $(CompileXamlDependsOn)
12 | PreprocessXaml;
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 | string usingString = "=\"using:";
107 | string clrString = "=\"clr-namespace:";
108 |
109 | foreach(FileInfo xamlFile in new DirectoryInfo(Folder).GetFiles("*.xaml", SearchOption.AllDirectories))
110 | {
111 | Log.LogMessage("Replacing in File: " + xamlFile.FullName, MessageImportance.High);
112 | string content = System.IO.File.ReadAllText(xamlFile.FullName);
113 |
114 | if(DefineConstants.Contains("NETFX_CORE"))
115 | {
116 |
117 | StringBuilder replacedLines = new StringBuilder();
118 | string[] allLines = System.IO.File.ReadAllLines(xamlFile.FullName);
119 | foreach (string line in allLines)
120 | {
121 | string replacedLine = line;
122 | replacedLine = replacedLine.Replace(clrString, usingString);
123 | replacedLine = replacedLine.Replace("{DynamicResource ", "{StaticResource ");
124 | if(replacedLine.Contains(";assembly="))
125 | { //remove 'assembly=..." from the line
126 | int startOfAssembly = replacedLine.IndexOf(";assembly=");
127 | int endOfAssembly = replacedLine.IndexOf("\"", startOfAssembly);
128 | replacedLine = replacedLine.Remove(startOfAssembly, endOfAssembly - startOfAssembly);
129 | }
130 | replacedLine = replacedLine.Replace("xmlns:cal=\"http://www.caliburnproject.org\"", "xmlns:cal=\"clr-namespace:Caliburn.Micro\"");
131 | replacedLines.AppendLine(replacedLine);
132 | }
133 |
134 | //content = content.Replace("xmlns:cal=\"http://www.caliburnproject.org\"", "xmlns:cal=\"clr-namespace:Caliburn.Micro\"");
135 | //content = content.Replace(clrString, usingString);
136 | System.IO.File.WriteAllText(xamlFile.FullName, replacedLines.ToString());
137 | Log.LogMessage("Writing to " + xamlFile.FullName, MessageImportance.High);
138 | }
139 | else
140 | {
141 | if(content.Contains(usingString))
142 | {
143 | content = content.Replace(usingString, clrString);
144 | System.IO.File.WriteAllText(xamlFile.FullName, content);
145 | Log.LogMessage("Writing to " + xamlFile.FullName, MessageImportance.High);
146 | }
147 | }
148 | }
149 |
150 |
151 |
152 |
153 |
154 |
155 |
156 |
157 |
158 |
163 |
--------------------------------------------------------------------------------
/De.TorstenMandelkow.MetroChart/Core/PieceBase.cs:
--------------------------------------------------------------------------------
1 | namespace De.TorstenMandelkow.MetroChart
2 | {
3 | using System;
4 | using System.Collections;
5 | using System.Collections.Generic;
6 | using System.ComponentModel;
7 | using System.Linq;
8 | using System.Text;
9 | using System.Windows;
10 | using System.Reflection;
11 | using System.Collections.Specialized;
12 | using System.Windows.Input;
13 |
14 | #if NETFX_CORE
15 | using Windows.UI.Xaml.Controls;
16 | using Windows.UI.Xaml.Media;
17 | using Windows.UI.Xaml.Shapes;
18 | using Windows.UI.Xaml.Markup;
19 | using Windows.UI.Xaml;
20 | using Windows.Foundation;
21 | using Windows.UI;
22 | using Windows.UI.Xaml.Media.Animation;
23 | using Windows.UI.Core;
24 | #else
25 | using System.Windows.Media;
26 | using System.Windows.Controls;
27 | using System.Windows.Media.Animation;
28 | using System.Windows.Shapes;
29 |
30 | #endif
31 |
32 | [TemplateVisualState(Name = BarPiece.StateSelectionUnselected, GroupName = BarPiece.GroupSelectionStates)]
33 | [TemplateVisualState(Name = BarPiece.StateSelectionSelected, GroupName = BarPiece.GroupSelectionStates)]
34 | public abstract class PieceBase : Control
35 | {
36 | #region Fields
37 |
38 | internal const string StateSelectionUnselected = "Unselected";
39 | internal const string StateSelectionSelected = "Selected";
40 | internal const string GroupSelectionStates = "SelectionStates";
41 |
42 | public static readonly DependencyProperty ClientHeightProperty =
43 | DependencyProperty.Register("ClientHeight", typeof(double), typeof(PieceBase),
44 | new PropertyMetadata(0.0, new PropertyChangedCallback(OnSizeChanged)));
45 |
46 | public static readonly DependencyProperty ClientWidthProperty =
47 | DependencyProperty.Register("ClientWidth", typeof(double), typeof(PieceBase),
48 | new PropertyMetadata(0.0, new PropertyChangedCallback(OnSizeChanged)));
49 |
50 | public static readonly DependencyProperty SelectedBrushProperty =
51 | DependencyProperty.Register("SelectedBrush", typeof(Brush), typeof(PieceBase),
52 | new PropertyMetadata(null));
53 |
54 | public static readonly DependencyProperty ParentChartProperty =
55 | DependencyProperty.Register("ParentChart", typeof(ChartBase), typeof(PieceBase),
56 | new PropertyMetadata(null));
57 |
58 | public static readonly DependencyProperty IsSelectedProperty =
59 | DependencyProperty.Register("IsSelected", typeof(bool), typeof(PieceBase),
60 | new PropertyMetadata(false, new PropertyChangedCallback(OnIsSelectedChanged)));
61 |
62 | public static readonly DependencyProperty IsClickedByUserProperty =
63 | DependencyProperty.Register("IsClickedByUser", typeof(bool), typeof(PieceBase),
64 | new PropertyMetadata(false));
65 |
66 | #endregion Fields
67 |
68 | #region Properties
69 |
70 | public double ClientHeight
71 | {
72 | get { return (double)GetValue(ClientHeightProperty); }
73 | set { SetValue(ClientHeightProperty, value); }
74 | }
75 |
76 | public double ClientWidth
77 | {
78 | get { return (double)GetValue(ClientWidthProperty); }
79 | set { SetValue(ClientWidthProperty, value); }
80 | }
81 |
82 | public bool IsSelected
83 | {
84 | get { return (bool)GetValue(IsSelectedProperty); }
85 | set { SetValue(IsSelectedProperty, value); }
86 | }
87 |
88 | public bool IsClickedByUser
89 | {
90 | get { return (bool)GetValue(IsClickedByUserProperty); }
91 | set { SetValue(IsClickedByUserProperty, value); }
92 | }
93 |
94 | public ChartBase ParentChart
95 | {
96 | get { return (ChartBase)GetValue(ParentChartProperty); }
97 | set { SetValue(ParentChartProperty, value); }
98 | }
99 |
100 | public Brush SelectedBrush
101 | {
102 | get { return (Brush)GetValue(SelectedBrushProperty); }
103 | set { SetValue(SelectedBrushProperty, value); }
104 | }
105 |
106 | public string Caption
107 | {
108 | get
109 | {
110 | return (this.DataContext as DataPoint).DisplayName;
111 | }
112 | }
113 |
114 | #endregion Properties
115 |
116 | #region Methods
117 |
118 | private static void OnSizeChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
119 | {
120 | (d as PieceBase).DrawGeometry(false);
121 | }
122 |
123 | protected virtual void DrawGeometry(bool withAnimation = true)
124 | {
125 | }
126 |
127 | private static void OnIsSelectedChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
128 | {
129 | PieceBase source = (PieceBase)d;
130 | bool oldValue = (bool)e.OldValue;
131 | bool newValue = (bool)e.NewValue;
132 | source.OnIsSelectedPropertyChanged(oldValue, newValue);
133 | }
134 |
135 | protected virtual void OnIsSelectedPropertyChanged(bool oldValue, bool newValue)
136 | {
137 | this.IsClickedByUser = false;
138 | VisualStateManager.GoToState(this, newValue ? StateSelectionSelected : StateSelectionUnselected, true);
139 | }
140 |
141 | #if NETFX_CORE
142 | protected override void OnApplyTemplate()
143 | {
144 | base.OnApplyTemplate();
145 | InternalOnApplyTemplate();
146 | }
147 | #else
148 | public override void OnApplyTemplate()
149 | {
150 | base.OnApplyTemplate();
151 | InternalOnApplyTemplate();
152 | }
153 | #endif
154 |
155 | protected virtual void InternalOnApplyTemplate()
156 | {
157 | }
158 |
159 | protected void RegisterMouseEvents(UIElement slice)
160 | {
161 |
162 | if (slice != null)
163 | {
164 | #if NETFX_CORE
165 | slice.PointerPressed += delegate
166 | #else
167 | slice.MouseLeftButtonUp += delegate
168 | #endif
169 | {
170 | InternalMousePressed();
171 | };
172 |
173 | #if NETFX_CORE
174 | slice.PointerMoved += delegate
175 | #else
176 | slice.MouseMove += delegate
177 | #endif
178 | {
179 | InternalMouseMoved();
180 | };
181 | }
182 | }
183 |
184 | private void InternalMousePressed()
185 | {
186 | SetValue(PieceBase.IsClickedByUserProperty, true);
187 | }
188 |
189 | private void InternalMouseMoved()
190 | {
191 | //SetValue(PieceBase.Is, true);
192 | }
193 |
194 | #if NETFX_CORE
195 | protected override void OnPointerPressed(Windows.UI.Xaml.Input.PointerRoutedEventArgs e)
196 | {
197 | base.OnPointerPressed(e);
198 | HandleMouseDown();
199 | e.Handled = true;
200 | }
201 | #else
202 | protected override void OnMouseLeftButtonDown(MouseButtonEventArgs e)
203 | {
204 | base.OnMouseLeftButtonDown(e);
205 | HandleMouseDown();
206 | e.Handled = true;
207 | }
208 | #endif
209 |
210 | private void HandleMouseDown()
211 | {
212 | IsClickedByUser = true;
213 | }
214 |
215 | #endregion Methods
216 | }
217 | }
218 |
--------------------------------------------------------------------------------
/De.TorstenMandelkow.MetroChart/Controls/MinimalWidthTextBlock.cs:
--------------------------------------------------------------------------------
1 | namespace De.TorstenMandelkow.MetroChart
2 | {
3 | using System;
4 | using System.Collections.Generic;
5 | using System.Linq;
6 | using System.Text;
7 |
8 | #if NETFX_CORE
9 | using Windows.UI.Xaml.Controls;
10 | using Windows.UI.Xaml.Media;
11 | using Windows.UI.Xaml.Shapes;
12 | using Windows.UI.Xaml.Markup;
13 | using Windows.UI.Xaml;
14 | using Windows.Foundation;
15 | using Windows.UI;
16 | using Windows.UI.Xaml.Media.Animation;
17 | using Windows.UI.Core;
18 | #else
19 | using System.Windows.Media;
20 | using System.Windows.Controls;
21 | using System.Windows;
22 | #endif
23 |
24 | #if SILVERLIGHT
25 | public class MinimalWidthTextBlock : Control
26 | #else
27 | public class MinimalWidthTextBlock : Control
28 | #endif
29 | {
30 | private const char DEFAULTCHARSEPARATOR = '|';
31 |
32 |
33 | public static readonly DependencyProperty TextBlockStyleProperty =
34 | DependencyProperty.Register("TextBlockStyle", typeof(Style), typeof(MinimalWidthTextBlock),
35 | new PropertyMetadata(null));
36 |
37 | public static readonly DependencyProperty TextProperty =
38 | DependencyProperty.Register("Text", typeof(string), typeof(MinimalWidthTextBlock),
39 | new PropertyMetadata(null));
40 |
41 | static MinimalWidthTextBlock()
42 | {
43 | #if NETFX_CORE
44 | //do nothing
45 | #elif SILVERLIGHT
46 | //do nothing
47 | #else
48 | DefaultStyleKeyProperty.OverrideMetadata(typeof(MinimalWidthTextBlock), new FrameworkPropertyMetadata(typeof(MinimalWidthTextBlock)));
49 | #endif
50 | }
51 |
52 | public MinimalWidthTextBlock()
53 | {
54 | #if NETFX_CORE
55 | this.DefaultStyleKey = typeof(MinimalWidthTextBlock);
56 | #elif SILVERLIGHT
57 | this.DefaultStyleKey = typeof(MinimalWidthTextBlock);
58 | #else
59 | //do nothing
60 | #endif
61 | }
62 |
63 | #if NETFX_CORE
64 | protected override void OnApplyTemplate()
65 | {
66 | base.OnApplyTemplate();
67 | InternalOnApplyTemplate();
68 | }
69 | #else
70 | public override void OnApplyTemplate()
71 | {
72 | base.OnApplyTemplate();
73 | InternalOnApplyTemplate();
74 | }
75 | #endif
76 | Border mainBorder = null;
77 | TextBlock mainTextBlock = null;
78 | private void InternalOnApplyTemplate()
79 | {
80 | mainBorder = this.GetTemplateChild("PART_Border") as Border;
81 | mainTextBlock = this.GetTemplateChild("PART_TextBlock") as TextBlock;
82 | }
83 |
84 | public Style TextBlockStyle
85 | {
86 | get { return (Style)GetValue(TextBlockStyleProperty); }
87 | set { SetValue(TextBlockStyleProperty, value); }
88 | }
89 |
90 | public string Text
91 | {
92 | get { return (string)GetValue(TextProperty); }
93 | set { SetValue(TextProperty, value); }
94 | }
95 |
96 | protected override Size MeasureOverride(Size availableSize)
97 | {
98 | Size baseSize = base.MeasureOverride(availableSize);
99 |
100 | if (mainTextBlock != null)
101 | {
102 | string text = mainTextBlock.Text;
103 | char separator = DEFAULTCHARSEPARATOR;
104 |
105 | if (text.Contains(" "))
106 | {
107 | separator = ' ';
108 | }
109 | if (text.Contains("."))
110 | {
111 | separator = '.';
112 | }
113 | if (separator != DEFAULTCHARSEPARATOR)
114 | {
115 | //find all combinations how the sentence could be split into 2 lines
116 | List allcombinations = GetAllLinesCombinations(text, separator);
117 |
118 | double bestWidth = double.PositiveInfinity;
119 | foreach (string[] combination in allcombinations)
120 | {
121 | //now find the max width of the combination
122 | double maxwidth = GetMaxTextWidth(combination);
123 |
124 | //but we want the smallest combination
125 | if (maxwidth < bestWidth)
126 | {
127 | bestWidth = maxwidth;
128 | }
129 | }
130 |
131 | return new Size(bestWidth, GetLineHeight(mainTextBlock.Text) * 2);
132 | }
133 | }
134 |
135 | return baseSize;
136 | }
137 |
138 | private double GetLineHeight(string teststring)
139 | {
140 | TextBlock b = GetCopyOfMainTextBlock();
141 | b.Text = "teststring";
142 | b.Measure(new Size(double.PositiveInfinity, double.PositiveInfinity));
143 | return b.DesiredSize.Height;
144 | }
145 |
146 | private TextBlock GetCopyOfMainTextBlock()
147 | {
148 | TextBlock b = new TextBlock();
149 | b.FontFamily = mainTextBlock.FontFamily;
150 | b.FontSize = mainTextBlock.FontSize;
151 | b.FontStyle = mainTextBlock.FontStyle;
152 | b.LineHeight = mainTextBlock.LineHeight;
153 | b.LineStackingStrategy = mainTextBlock.LineStackingStrategy;
154 | b.FontWeight = mainTextBlock.FontWeight;
155 | return b;
156 | }
157 |
158 | private double GetMaxTextWidth(string[] combination)
159 | {
160 | double longestLineWidth = 0.0;
161 | foreach (string line in combination)
162 | {
163 | double lineWidth = GetLineWidth(line);
164 | if (lineWidth > longestLineWidth)
165 | {
166 | longestLineWidth = lineWidth;
167 | }
168 | }
169 | return longestLineWidth;
170 | }
171 |
172 | private double GetLineWidth(string line)
173 | {
174 | TextBlock b = GetCopyOfMainTextBlock();
175 | b.Text = line;
176 | b.Measure(new Size(double.PositiveInfinity, double.PositiveInfinity));
177 | return b.DesiredSize.Width;
178 | }
179 |
180 | private List GetAllLinesCombinations(string text, char separator)
181 | {
182 | // Number of site features
183 | List combinations = new List();
184 | //string[] allWords = text.Split(new char[] { ' ' });
185 | int startposition = 0;
186 |
187 | while (true)
188 | {
189 | int spacePosition = text.IndexOf(separator, startposition);
190 | if (spacePosition < 0)
191 | {
192 | return combinations;
193 | }
194 |
195 | string firstPart = text.Substring(0, spacePosition);
196 | string secondPart = text.Substring(spacePosition);
197 |
198 | combinations.Add(new string[] { firstPart.Trim(), secondPart.Trim() });
199 | startposition = spacePosition+1;
200 | }
201 | }
202 |
203 | protected override Size ArrangeOverride(Size finalSize)
204 | {
205 | mainBorder.Width = finalSize.Width;
206 | mainBorder.Height = finalSize.Height;
207 | return base.ArrangeOverride(finalSize);
208 | }
209 | }
210 | }
211 |
--------------------------------------------------------------------------------
/TestApplicationSL/TestApplicationSL.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Debug
5 | AnyCPU
6 | 8.0.50727
7 | 2.0
8 | {8F0A4417-85C6-4545-B9B2-5FF99035E369}
9 | {A1591282-1198-4647-A2B1-27E5FF5F6F3B};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}
10 | Library
11 | Properties
12 | TestApplicationSL
13 | TestApplicationSL
14 | Silverlight
15 | v5.0
16 | $(TargetFrameworkVersion)
17 | true
18 | de
19 | true
20 | true
21 | TestApplicationSL.xap
22 | Properties\AppManifest.xml
23 | TestApplicationSL.App
24 | TestApplicationSLTestPage.html
25 | true
26 | true
27 | false
28 | Properties\OutOfBrowserSettings.xml
29 | false
30 | true
31 |
32 |
33 | SAK
34 | SAK
35 | SAK
36 | SAK
37 |
38 |
39 |
42 |
43 | v3.5
44 |
45 |
46 | true
47 | full
48 | false
49 | Bin\Debug
50 | DEBUG;TRACE;SILVERLIGHT
51 | true
52 | true
53 | prompt
54 | 4
55 | false
56 |
57 |
58 | pdbonly
59 | true
60 | Bin\Release
61 | TRACE;SILVERLIGHT
62 | true
63 | true
64 | prompt
65 | 4
66 | false
67 |
68 |
69 |
70 |
71 |
72 |
73 | $(TargetFrameworkDirectory)System.Core.dll
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 | Controls\BooleanToVisibilityConverter.cs
82 |
83 |
84 | Controls\PortableHyperlinkButton.cs
85 |
86 |
87 | Controls\PortablePopup.cs
88 |
89 |
90 | Controls\StringToBrushConverter.cs
91 |
92 |
93 | Controls\StringToDataTemplateConverter.cs
94 |
95 |
96 | ViewModel\TestClass.cs
97 |
98 |
99 | ViewModel\TestPageViewModel.cs
100 |
101 |
102 | App.xaml
103 |
104 |
105 | MainPage.xaml
106 |
107 |
108 |
109 |
110 |
111 |
112 | Designer
113 | MSBuild:Compile
114 |
115 |
116 | Designer
117 | MSBuild:Compile
118 |
119 |
120 | Designer
121 | MSBuild:Compile
122 |
123 |
124 | MSBuild:Compile
125 | Designer
126 | Always
127 |
128 |
129 |
130 |
131 | Shared\Fonts\seguisym.ttf
132 |
133 |
134 |
135 |
136 |
137 |
138 | {46dd5fb9-30e3-488f-8ff5-13f33dc5a488}
139 | De.TorstenMandelkow.MetroChart
140 |
141 |
142 |
143 |
144 | Shared\Images\torsten.png
145 |
146 |
147 |
148 |
149 |
156 |
157 |
158 |
159 |
160 |
161 |
162 |
163 |
--------------------------------------------------------------------------------