mirror of
https://gitee.com/akwkevin/aistudio.-wpf.-diagram
synced 2026-03-20 08:26:36 +08:00
项目结构调整
This commit is contained in:
@@ -0,0 +1,58 @@
|
||||
<UserControl x:Class="Wpf.CartesianChart.SharedTooltip.SharedTooltipExample"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:Wpf.CartesianChart.SharedTooltip"
|
||||
xmlns:lvc="clr-namespace:LiveCharts.Wpf;assembly=LiveCharts.Wpf"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="300" d:DesignWidth="300" d:DataContext="{d:DesignInstance local:SharedTooltipExample }">
|
||||
<Canvas Name="CanvasContainer">
|
||||
|
||||
<!--
|
||||
the tooltip requires a canvas to move properly,
|
||||
so lets wrap our view where you need a shared tooltip
|
||||
with a Canvas container
|
||||
-->
|
||||
|
||||
<lvc:DefaultTooltip Name="CurrentTooltip" Visibility="Hidden"
|
||||
Panel.ZIndex="100"
|
||||
Canvas.Left="0" Canvas.Top="0"
|
||||
IsWrapped="True">
|
||||
<!--
|
||||
it needs to:
|
||||
1. Have an initial position
|
||||
2. Be hidden on startup
|
||||
3. to be wrapped in a Canvas, and say it with IsWrapped = true
|
||||
-->
|
||||
</lvc:DefaultTooltip>
|
||||
|
||||
<Grid Height="{Binding ActualHeight, ElementName=CanvasContainer}"
|
||||
Width="{Binding ActualWidth, ElementName=CanvasContainer}">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*"></ColumnDefinition>
|
||||
<ColumnDefinition Width="*"></ColumnDefinition>
|
||||
<ColumnDefinition Width="*"></ColumnDefinition>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<lvc:CartesianChart Grid.Column="0" Background="White"
|
||||
DataTooltip="{Binding ElementName=CurrentTooltip}">
|
||||
<lvc:CartesianChart.Series>
|
||||
<lvc:LineSeries Values="1,2,3,4,5" LabelPoint="{Binding LabelPoint}"></lvc:LineSeries>
|
||||
</lvc:CartesianChart.Series>
|
||||
</lvc:CartesianChart>
|
||||
<lvc:CartesianChart Grid.Column="1" Background="White"
|
||||
DataTooltip="{Binding ElementName=CurrentTooltip}">
|
||||
<lvc:CartesianChart.Series>
|
||||
<lvc:LineSeries Values="1,2,3,4,5" LabelPoint="{Binding LabelPoint}"></lvc:LineSeries>
|
||||
</lvc:CartesianChart.Series>
|
||||
</lvc:CartesianChart>
|
||||
<lvc:CartesianChart Grid.Column="2" Background="White"
|
||||
DataTooltip="{Binding ElementName=CurrentTooltip}">
|
||||
<lvc:CartesianChart.Series>
|
||||
<lvc:LineSeries Values="1,2,3,4,5" LabelPoint="{Binding LabelPoint}" ></lvc:LineSeries>
|
||||
</lvc:CartesianChart.Series>
|
||||
</lvc:CartesianChart>
|
||||
</Grid>
|
||||
</Canvas>
|
||||
</UserControl>
|
||||
@@ -0,0 +1,35 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
using LiveCharts;
|
||||
|
||||
namespace Wpf.CartesianChart.SharedTooltip
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for SharedTooltip.xaml
|
||||
/// </summary>
|
||||
public partial class SharedTooltipExample : UserControl
|
||||
{
|
||||
public SharedTooltipExample()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
LabelPoint = x => "A long label so it overflows " + x;
|
||||
|
||||
DataContext = this;
|
||||
}
|
||||
|
||||
public Func<ChartPoint, string> LabelPoint { get; set; }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user