mirror of
https://gitee.com/akwkevin/aistudio.-wpf.-diagram
synced 2026-03-20 00:16:36 +08:00
项目结构调整
This commit is contained in:
@@ -0,0 +1,51 @@
|
||||
<Page
|
||||
x:Class="UWP.CartesianChart.SectionsDragable.DragableSections"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="using:UWP.CartesianChart.SectionsDragable"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:lvc="using:LiveCharts.Uwp"
|
||||
mc:Ignorable="d">
|
||||
|
||||
<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"></RowDefinition>
|
||||
<RowDefinition Height="*"></RowDefinition>
|
||||
</Grid.RowDefinitions>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock>Click, hold and drag any section =></TextBlock>
|
||||
<TextBlock>X:</TextBlock>
|
||||
<TextBlock Text="{Binding XSection}"></TextBlock>
|
||||
<TextBlock>, Y:</TextBlock>
|
||||
<TextBlock Text="{Binding YSection}"></TextBlock>
|
||||
</StackPanel>
|
||||
<lvc:CartesianChart Grid.Row="1">
|
||||
<lvc:CartesianChart.Series>
|
||||
<lvc:LineSeries Values="{Binding ChartValues}"></lvc:LineSeries>
|
||||
</lvc:CartesianChart.Series>
|
||||
<lvc:CartesianChart.AxisX>
|
||||
<lvc:Axis>
|
||||
<lvc:Axis.Sections>
|
||||
<lvc:AxisSection Draggable="True"
|
||||
Value="{Binding XSection, Mode=TwoWay}"
|
||||
StrokeThickness="4"
|
||||
Stroke="DarkSlateBlue"
|
||||
Canvas.ZIndex="99"/>
|
||||
</lvc:Axis.Sections>
|
||||
</lvc:Axis>
|
||||
</lvc:CartesianChart.AxisX>
|
||||
<lvc:CartesianChart.AxisY>
|
||||
<lvc:Axis>
|
||||
<lvc:Axis.Sections>
|
||||
<lvc:AxisSection Draggable="True"
|
||||
Value="{Binding YSection, Mode=TwoWay}"
|
||||
StrokeThickness="4"
|
||||
Stroke="DarkSlateBlue"
|
||||
Canvas.ZIndex="99"/>
|
||||
</lvc:Axis.Sections>
|
||||
</lvc:Axis>
|
||||
</lvc:CartesianChart.AxisY>
|
||||
</lvc:CartesianChart>
|
||||
</Grid>
|
||||
</Page>
|
||||
@@ -0,0 +1,56 @@
|
||||
using LiveCharts;
|
||||
using System.ComponentModel;
|
||||
using Windows.UI.Xaml.Controls;
|
||||
|
||||
// The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=234238
|
||||
|
||||
namespace UWP.CartesianChart.SectionsDragable
|
||||
{
|
||||
/// <summary>
|
||||
/// An empty page that can be used on its own or navigated to within a Frame.
|
||||
/// </summary>
|
||||
public sealed partial class DragableSections : Page, INotifyPropertyChanged
|
||||
{
|
||||
private double _xSection;
|
||||
private double _ySection;
|
||||
|
||||
public DragableSections()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
XSection = 5;
|
||||
YSection = 5;
|
||||
|
||||
DataContext = this;
|
||||
}
|
||||
|
||||
public double XSection
|
||||
{
|
||||
get { return _xSection; }
|
||||
set
|
||||
{
|
||||
_xSection = value;
|
||||
OnPropertyChanged("XSection");
|
||||
}
|
||||
}
|
||||
|
||||
public double YSection
|
||||
{
|
||||
get { return _ySection; }
|
||||
set
|
||||
{
|
||||
_ySection = value;
|
||||
OnPropertyChanged("YSection");
|
||||
}
|
||||
}
|
||||
|
||||
public IChartValues ChartValues { get; set; } = new ChartValues<int>(new int[] { 7, 2, 8, 2, 7, 4, 9, 4, 2, 8 });
|
||||
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
|
||||
public void OnPropertyChanged(string propertyName)
|
||||
{
|
||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user