mirror of
https://gitee.com/akwkevin/aistudio.-wpf.-diagram
synced 2026-04-15 21:56:37 +08:00
项目结构调整
This commit is contained in:
107
Others/Live-Charts-master/Examples/Wpf/Home/HomeView.xaml
Normal file
107
Others/Live-Charts-master/Examples/Wpf/Home/HomeView.xaml
Normal file
@@ -0,0 +1,107 @@
|
||||
<controls:MetroWindow x:Class="Wpf.Home.HomeView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:controls="http://metro.mahapps.com/winfx/xaml/controls"
|
||||
xmlns:home="clr-namespace:Wpf.Home"
|
||||
mc:Ignorable="d" Height="650" Width="1100"
|
||||
Style="{StaticResource WindowStyle}"
|
||||
WindowStartupLocation="CenterScreen"
|
||||
ShowIconOnTitleBar="True"
|
||||
MinWidth="900"
|
||||
Name="Window"
|
||||
Background="WhiteSmoke">
|
||||
<controls:MetroWindow.IconTemplate>
|
||||
<DataTemplate>
|
||||
<Image Source="../Resources/LiveChartsLogo.png" Margin="10 0" Stretch="None"></Image>
|
||||
</DataTemplate>
|
||||
</controls:MetroWindow.IconTemplate>
|
||||
<controls:MetroWindow.DataContext>
|
||||
<home:HomeViewModel></home:HomeViewModel>
|
||||
</controls:MetroWindow.DataContext>
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="300" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Border Grid.Column="0" Effect="{StaticResource CardShadow}" Background="White">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"></RowDefinition>
|
||||
<RowDefinition Height="Auto"></RowDefinition>
|
||||
<RowDefinition Height="*"></RowDefinition>
|
||||
</Grid.RowDefinitions>
|
||||
<TextBlock Style="{StaticResource H5}" Opacity="{StaticResource SecondaryTextOpacity}" Padding="10 20 10 5">Select any of the following examples</TextBlock>
|
||||
<Border Grid.Row="1" Background="#4E303030" Height="30" CornerRadius="12" Margin="15 5" BorderThickness="0" Effect="{StaticResource CardShadow}">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<!--
|
||||
Icon made by Madebyoliver (http://www.flaticon.es/autores/madebyoliver)
|
||||
from http://www.flaticon.com
|
||||
license CC 3.0 BY (http://creativecommons.org/licenses/by/3.0/)
|
||||
-->
|
||||
<Path Stretch="Fill" Height="18" Width="18" Fill="White" Margin="8 0" StrokeThickness="1" Stroke="White" Data="M55.146,51.887L41.588,37.786c3.486-4.144,5.396-9.358,5.396-14.786c0-12.682-10.318-23-23-23s-23,10.318-23,23 s10.318,23,23,23c4.761,0,9.298-1.436,13.177-4.162l13.661,14.208c0.571,0.593,1.339,0.92,2.162,0.92 c0.779,0,1.518-0.297,2.079-0.837C56.255,54.982,56.293,53.08,55.146,51.887z M23.984,6c9.374,0,17,7.626,17,17s-7.626,17-17,17 s-17-7.626-17-17S14.61,6,23.984,6z"></Path>
|
||||
<TextBox Width="220" Background="Transparent" BorderThickness="0" Foreground="#303030" Text="{Binding Criteria, UpdateSourceTrigger=PropertyChanged, Mode=TwoWay}" VerticalAlignment="Center"></TextBox>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
<ScrollViewer Grid.Row="2">
|
||||
<Grid>
|
||||
<ItemsControl Margin="0,0,-12,0" ItemsSource="{Binding Samples}" >
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<StackPanel>
|
||||
<TextBlock Text="{Binding Name}" Style="{StaticResource H3}" Foreground="#0398E2" HorizontalAlignment="Left" Padding="10"></TextBlock>
|
||||
<ItemsControl ItemsSource="{Binding Items}">
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<Border MouseDown="UIElement_OnMouseDown" Style="{StaticResource MenuItem}" Width="280">
|
||||
<TextBlock Grid.Row="0" Grid.Column="1" Style="{StaticResource H5}" HorizontalAlignment="Left" Text="{Binding Title}"/>
|
||||
</Border>
|
||||
</DataTemplate>
|
||||
</ItemsControl.ItemTemplate>
|
||||
</ItemsControl>
|
||||
</StackPanel>
|
||||
</DataTemplate>
|
||||
</ItemsControl.ItemTemplate>
|
||||
</ItemsControl>
|
||||
</Grid>
|
||||
</ScrollViewer>
|
||||
</Grid>
|
||||
</Border>
|
||||
<Border Grid.Column="1" BorderThickness="0 1 0 0" BorderBrush="#E6E6E6">
|
||||
<Grid >
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"></RowDefinition>
|
||||
<RowDefinition Height="Auto"></RowDefinition>
|
||||
<RowDefinition Height="*"></RowDefinition>
|
||||
</Grid.RowDefinitions>
|
||||
<Border Background="#303030" Padding="20">
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
|
||||
<Button Margin="5 0">
|
||||
<Hyperlink NavigateUri="https://lvcharts.net/App/documentation/wpf/introduction" RequestNavigate="RequestNavigate">Object Explorer</Hyperlink>
|
||||
</Button>
|
||||
<Button Margin="5 0">
|
||||
<Hyperlink NavigateUri="https://github.com/beto-rodriguez/Live-Charts" RequestNavigate="RequestNavigate">Source Code</Hyperlink>
|
||||
</Button>
|
||||
<Button Margin="5 0">
|
||||
<Hyperlink NavigateUri="https://lvcharts.net/App/examples/wpf/start" RequestNavigate="RequestNavigate">Tutorials and examples</Hyperlink>
|
||||
</Button>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
<Border Grid.Row="1" Padding="10" Background="#0398E2" Effect="{StaticResource CardShadow}">
|
||||
<TextBlock Foreground="{StaticResource WhiteBrush}" HorizontalAlignment="Center" TextWrapping="Wrap" Style="{StaticResource H5}">
|
||||
<Hyperlink NavigateUri="https://lvcharts.net/licensing/pricing" RequestNavigate="RequestNavigate">
|
||||
<Bold>Psst!</Bold> Get LiveCharts.Geared and extend LiveCharts to a high performance charting library
|
||||
</Hyperlink>
|
||||
</TextBlock>
|
||||
</Border>
|
||||
<Border Grid.Row="2" Margin="25" Background="White" CornerRadius="3"
|
||||
Effect="{StaticResource CardShadow}" Padding="8"
|
||||
BorderThickness="1" BorderBrush="#EBEBEB">
|
||||
<ContentPresenter Content="{Binding Content}"/>
|
||||
</Border>
|
||||
</Grid>
|
||||
</Border>
|
||||
</Grid>
|
||||
</controls:MetroWindow>
|
||||
|
||||
31
Others/Live-Charts-master/Examples/Wpf/Home/HomeView.xaml.cs
Normal file
31
Others/Live-Charts-master/Examples/Wpf/Home/HomeView.xaml.cs
Normal file
@@ -0,0 +1,31 @@
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Navigation;
|
||||
using MahApps.Metro.Controls;
|
||||
|
||||
namespace Wpf.Home
|
||||
{
|
||||
public partial class HomeView : MetroWindow
|
||||
{
|
||||
public HomeView()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void RequestNavigate(object sender, RequestNavigateEventArgs e)
|
||||
{
|
||||
Process.Start(new ProcessStartInfo(e.Uri.AbsoluteUri));
|
||||
e.Handled = true;
|
||||
}
|
||||
|
||||
private void UIElement_OnMouseDown(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
var sample = (SampleVm)((Border)sender).DataContext;
|
||||
var hvm = (HomeViewModel) DataContext;
|
||||
hvm.Content = (UserControl) Activator.CreateInstance(sample.Content);
|
||||
hvm.IsMenuOpen = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
233
Others/Live-Charts-master/Examples/Wpf/Home/HomeViewModel.cs
Normal file
233
Others/Live-Charts-master/Examples/Wpf/Home/HomeViewModel.cs
Normal file
@@ -0,0 +1,233 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using LiveCharts.Defaults;
|
||||
using LiveCharts.Wpf;
|
||||
using Wpf.CartesianChart;
|
||||
using Wpf.CartesianChart.BasicLine;
|
||||
using Wpf.CartesianChart.Basic_Bars;
|
||||
using Wpf.CartesianChart.Basic_Stacked_Bar;
|
||||
using Wpf.CartesianChart.Bubbles;
|
||||
using Wpf.CartesianChart.Chart_to_Image;
|
||||
using Wpf.CartesianChart.ConstantChanges;
|
||||
using Wpf.CartesianChart.Customized_Line_Series;
|
||||
using Wpf.CartesianChart.CustomTooltipAndLegend;
|
||||
using Wpf.CartesianChart.DataLabelTemplate;
|
||||
using Wpf.CartesianChart.DateAxis;
|
||||
using Wpf.CartesianChart.DynamicVisibility;
|
||||
using Wpf.CartesianChart.Energy_Predictions;
|
||||
using Wpf.CartesianChart.Events;
|
||||
using Wpf.CartesianChart.Financial;
|
||||
using Wpf.CartesianChart.FullyResponsive;
|
||||
using Wpf.CartesianChart.Funnel_Chart;
|
||||
using Wpf.CartesianChart.HeatChart;
|
||||
using Wpf.CartesianChart.Inverted_Series;
|
||||
using Wpf.CartesianChart.Irregular_Intervals;
|
||||
using Wpf.CartesianChart.Linq;
|
||||
using Wpf.CartesianChart.LogarithmScale;
|
||||
using Wpf.CartesianChart.ManualZAndP;
|
||||
using Wpf.CartesianChart.MaterialCards;
|
||||
using Wpf.CartesianChart.Missing_Line_Points;
|
||||
using Wpf.CartesianChart.NegativeStackedRow;
|
||||
using Wpf.CartesianChart.PointState;
|
||||
using Wpf.CartesianChart.ScatterPlot;
|
||||
using Wpf.CartesianChart.Scatter_With_Pies;
|
||||
using Wpf.CartesianChart.Sections;
|
||||
using Wpf.CartesianChart.SectionsDragable;
|
||||
using Wpf.CartesianChart.SectionsMouseMove;
|
||||
using Wpf.CartesianChart.SolidColorChart;
|
||||
using Wpf.CartesianChart.StackedArea;
|
||||
using Wpf.CartesianChart.StepLine;
|
||||
using Wpf.CartesianChart.ThreadSafe;
|
||||
using Wpf.CartesianChart.UIElements;
|
||||
using Wpf.CartesianChart.WindowAxis;
|
||||
using Wpf.CartesianChart.ZoomingAndPanning;
|
||||
using Wpf.Gauges;
|
||||
using Wpf.Maps;
|
||||
using Wpf.PieChart;
|
||||
using Wpf.PieChart.DropDowns;
|
||||
|
||||
namespace Wpf.Home
|
||||
{
|
||||
public class HomeViewModel : INotifyPropertyChanged
|
||||
{
|
||||
private UserControl _content;
|
||||
private bool _isMenuOpen;
|
||||
private string _criteria;
|
||||
private IEnumerable<SampleGroupVm> _samples;
|
||||
private readonly IEnumerable<SampleGroupVm> _dataSource;
|
||||
|
||||
public HomeViewModel()
|
||||
{
|
||||
IsMenuOpen = true;
|
||||
_dataSource = new[]
|
||||
{
|
||||
new SampleGroupVm
|
||||
{
|
||||
Name = "Customizing",
|
||||
Items = new[]
|
||||
{
|
||||
new SampleVm("Series", typeof(CustomizedLineSeries)),
|
||||
new SampleVm("Tooltips/Legends", typeof(CustomTooltipAndLegendExample)),
|
||||
new SampleVm("Material Design", typeof(MaterialCards)),
|
||||
new SampleVm("Solid Color", typeof(SolidColorExample)),
|
||||
new SampleVm("Energy Predictions", typeof(EnergyPredictionExample)),
|
||||
new SampleVm("Funnel Chart", typeof(FunnelExample))
|
||||
}
|
||||
},
|
||||
new SampleGroupVm
|
||||
{
|
||||
Name = "Basic Plots",
|
||||
Items = new[]
|
||||
{
|
||||
new SampleVm("Lines", typeof(BasicLineExample)),
|
||||
new SampleVm("Columns", typeof(BasicColumn)),
|
||||
new SampleVm("Stacked Columns", typeof(StackedColumnExample)),
|
||||
new SampleVm("Rows", typeof(BasicRowExample)),
|
||||
new SampleVm("Stacked Area", typeof(StackedAreaExample)),
|
||||
new SampleVm("Step Line", typeof(StepLineExample)),
|
||||
new SampleVm("Scatter", typeof(ScatterExample)),
|
||||
new SampleVm("Bubbles", typeof(BubblesExample)),
|
||||
new SampleVm("OHCL Series", typeof(OhclExample)),
|
||||
new SampleVm("Candle Series", typeof(CandleStickExample)),
|
||||
new SampleVm("Pie Chart", typeof(PieChartExample)),
|
||||
new SampleVm("Doughnut Chart", typeof(DoughnutChartExample)),
|
||||
new SampleVm("Solid Gauges", typeof(Gauge360)),
|
||||
new SampleVm("Angular Gauge", typeof(AngularGaugeExmple)),
|
||||
new SampleVm("Heat Series", typeof(HeatSeriesExample)),
|
||||
new SampleVm("GeoHeatMap", typeof(GeoMapExample))
|
||||
}
|
||||
},
|
||||
new SampleGroupVm
|
||||
{
|
||||
Name = "Features",
|
||||
Items = new[]
|
||||
{
|
||||
new SampleVm("Inverted Series", typeof(InvertedExample)),
|
||||
new SampleVm("Sections", typeof(SectionsExample)),
|
||||
new SampleVm("Dragable Sections", typeof(DragableSections)),
|
||||
new SampleVm("Section Mouse Move", typeof(SectionMouseMoveSample)),
|
||||
new SampleVm("Multiple Axes", typeof(MultiAxesChart)),
|
||||
new SampleVm("Events", typeof(EventsExample)),
|
||||
new SampleVm("Visual Elements", typeof(UiElementsAndEventsExample)),
|
||||
new SampleVm("Chart to Image", typeof(ChartToImageSample)),
|
||||
new SampleVm("DataLabelTemplate", typeof(DataLabelTemplateSample))
|
||||
}
|
||||
},
|
||||
new SampleGroupVm
|
||||
{
|
||||
Name = "More",
|
||||
Items = new[]
|
||||
{
|
||||
new SampleVm("Irregular intervals", typeof(IrregularIntervalsExample)),
|
||||
new SampleVm("Pie with drop downs", typeof(PieDropDownSample)),
|
||||
new SampleVm("Missing Points", typeof(MissingPointsExample)),
|
||||
new SampleVm("Constant Changes", typeof(ConstantChangesChart)),
|
||||
new SampleVm("Thread Safe", typeof(ThreadSafeExample)),
|
||||
new SampleVm("Zooming/Panning", typeof(ZoomingAndPanning)),
|
||||
new SampleVm("Data Pagination", typeof(ManualZAndPExample)),
|
||||
new SampleVm("Scattered Pie", typeof(Scatter_With_Pies)),
|
||||
new SampleVm("Observable point", typeof(FullyResponsiveExample)),
|
||||
new SampleVm("Point State", typeof(PointStateExample)),
|
||||
new SampleVm("Negative Stacked", typeof(NegativeStackedRowExample)),
|
||||
new SampleVm("Dynamic Visibility", typeof(DynamicVisibilityExample)),
|
||||
new SampleVm("Filtering Data", typeof(LinqExample)),
|
||||
new SampleVm("Percentage Stacked", typeof(BasicStackedRowPercentageExample))
|
||||
}
|
||||
},
|
||||
new SampleGroupVm
|
||||
{
|
||||
Name = "Special axes",
|
||||
Items = new[]
|
||||
{
|
||||
new SampleVm("Window Axis", typeof(WindowAxisExample)),
|
||||
new SampleVm("Date Axis", typeof(DateAxisExample)),
|
||||
new SampleVm("Logarithmic Axis", typeof(LogarithmScaleExample))
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
_samples = _dataSource;
|
||||
}
|
||||
|
||||
public IEnumerable<SampleGroupVm> Samples
|
||||
{
|
||||
get { return _samples; }
|
||||
set
|
||||
{
|
||||
_samples = value;
|
||||
OnPropertyChanged("Samples");
|
||||
}
|
||||
}
|
||||
public UserControl Content
|
||||
{
|
||||
get { return _content; }
|
||||
set
|
||||
{
|
||||
_content = value;
|
||||
OnPropertyChanged("Content");
|
||||
}
|
||||
}
|
||||
public bool IsMenuOpen
|
||||
{
|
||||
get { return _isMenuOpen; }
|
||||
set
|
||||
{
|
||||
_isMenuOpen = value;
|
||||
OnPropertyChanged("IsMenuOpen");
|
||||
}
|
||||
}
|
||||
public string Criteria
|
||||
{
|
||||
get { return _criteria; }
|
||||
set
|
||||
{
|
||||
_criteria = value;
|
||||
OnPropertyChanged("Criteria");
|
||||
OnCriteriaChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
|
||||
protected virtual void OnPropertyChanged(string propertyName)
|
||||
{
|
||||
if (PropertyChanged != null)
|
||||
PropertyChanged.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
||||
}
|
||||
|
||||
private void OnCriteriaChanged()
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(Criteria))
|
||||
{
|
||||
Samples = _dataSource;
|
||||
return;
|
||||
}
|
||||
|
||||
Samples = Samples.Select(x => new SampleGroupVm
|
||||
{
|
||||
Name = x.Name,
|
||||
Items = x.Items.Where(y => y.Title.ToLowerInvariant().Contains(Criteria.ToLowerInvariant()) ||
|
||||
y.Tags.ToLowerInvariant().Contains(Criteria.ToLowerInvariant()))
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public class IsNullConverter : IValueConverter
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
return value == null;
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
10
Others/Live-Charts-master/Examples/Wpf/Home/SampleGroupVm.cs
Normal file
10
Others/Live-Charts-master/Examples/Wpf/Home/SampleGroupVm.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Wpf.Home
|
||||
{
|
||||
public class SampleGroupVm
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public IEnumerable<SampleVm> Items { get; set; }
|
||||
}
|
||||
}
|
||||
28
Others/Live-Charts-master/Examples/Wpf/Home/SampleVm.cs
Normal file
28
Others/Live-Charts-master/Examples/Wpf/Home/SampleVm.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
using System;
|
||||
|
||||
namespace Wpf.Home
|
||||
{
|
||||
public class SampleVm
|
||||
{
|
||||
private static int _idCount;
|
||||
|
||||
public SampleVm()
|
||||
{
|
||||
Id = _idCount++;
|
||||
Tags = string.Empty;
|
||||
}
|
||||
|
||||
public SampleVm(string title, Type content, string tags = "")
|
||||
{
|
||||
Id = _idCount++;
|
||||
Title = title;
|
||||
Content = content;
|
||||
Tags = tags;
|
||||
}
|
||||
|
||||
public int Id { get; private set; }
|
||||
public string Title { get; set; }
|
||||
public Type Content { get; set; }
|
||||
public string Tags { get; set; }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user