зеркало из https://github.com/stride3d/GraphX.git
+ Fixed weird assembly reference in showcase
+ Added some sketches for showcase app (internal)
This commit is contained in:
Родитель
268ac630ec
Коммит
77ca829f88
Двоичные данные
Examples/ShowcaseApp.WPF/Assets/SplashScreen.png
Двоичные данные
Examples/ShowcaseApp.WPF/Assets/SplashScreen.png
Двоичный файл не отображается.
До Ширина: | Высота: | Размер: 83 KiB После Ширина: | Высота: | Размер: 83 KiB |
|
@ -0,0 +1,33 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Shapes;
|
||||
using GraphX;
|
||||
|
||||
namespace ShowcaseApp.WPF.Models
|
||||
{
|
||||
public class EditorObjectManager: IDisposable
|
||||
{
|
||||
private GraphAreaExample _graphArea;
|
||||
|
||||
public EditorObjectManager(GraphAreaExample graphArea)
|
||||
{
|
||||
_graphArea = graphArea;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
_graphArea = null;
|
||||
}
|
||||
}
|
||||
|
||||
public class EdgeBlueprint
|
||||
{
|
||||
public VertexControl Source { get; set; }
|
||||
public VertexControl Target { get; set; }
|
||||
public Path EdgePath { get; set; }
|
||||
}
|
||||
}
|
|
@ -18,7 +18,7 @@ namespace ShowcaseApp.WPF.Pages
|
|||
|
||||
void butTest_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var win = new Window {Content = new GeneralGraph()};
|
||||
var win = new Window {Content = new EditorGraph()};
|
||||
win.ShowDialog();
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,62 @@
|
|||
<UserControl x:Class="ShowcaseApp.WPF.Pages.EditorGraph"
|
||||
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:wpf="clr-namespace:ShowcaseApp.WPF"
|
||||
xmlns:controls="clr-namespace:GraphX.Controls;assembly=GraphX.WPF.Controls"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="380" d:DesignWidth="600">
|
||||
<Grid>
|
||||
<Grid.Resources>
|
||||
<ResourceDictionary>
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="/Templates/EditorGraphXTemplates.xaml"/>
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
</ResourceDictionary>
|
||||
</Grid.Resources>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="*"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<Border CornerRadius="2" BorderBrush="{DynamicResource ButtonBorder}" Background="{DynamicResource ButtonBackground}" Margin="2" BorderThickness="1">
|
||||
<TextBlock Margin="1" TextWrapping="Wrap" TextAlignment="Center" Text="Create vertices and connect them with edges!"/>
|
||||
</Border>
|
||||
|
||||
<Border Grid.Row="1" Grid.Column="0" BorderBrush="{DynamicResource ButtonBorder}" BorderThickness="1" Margin="2" >
|
||||
<controls:ZoomControl x:Name="zoomCtrl" Background="Transparent" VerticalContentAlignment="Center" VerticalAlignment="Center">
|
||||
<wpf:GraphAreaExample x:Name="graphArea"/>
|
||||
</controls:ZoomControl>
|
||||
</Border>
|
||||
|
||||
|
||||
<DockPanel LastChildFill="False" Grid.Column="1" Grid.Row="0" Grid.RowSpan="2" Margin="3">
|
||||
<StackPanel DockPanel.Dock="Top" Orientation="Horizontal">
|
||||
<ToggleButton Width="25" Height="25">
|
||||
<Path Stretch="Uniform" Fill="#FF000000" Data="F1 M 29,18L 52.25,41.1667L 43.0865,42.6585L 50.817,56.6949L 43.827,60.4115L 36,46.25L 29,53.25L 29,18 Z "/>
|
||||
</ToggleButton>
|
||||
<ToggleButton Width="25" Height="25">
|
||||
<Path Stretch="Uniform" Fill="#FF000000" Data="F1 M 20.5833,55.4167L 49.0833,55.4167L 45.9167,52.25L 25.3333,52.25L 31.6667,49.0833L 25.3333,42.75L 22.1667,49.875C 22.1667,49.875 15.8333,55.4167 20.5833,55.4167 Z M 36.4166,47.5L 26.9166,38L 26.9166,41.1667L 33.25,47.5L 36.4166,47.5 Z M 28.8958,37.6042L 36.8125,45.5209C 38.3958,47.1042 42.75,42.75 42.75,42.75L 31.6666,31.6667C 26.9166,36.4167 28.8958,37.6042 28.8958,37.6042 Z M 44.3333,41.1667L 65.6868,16.8593C 63.2289,13.6452 60.224,10.8717 56.8112,8.67772L 33.25,30.0834L 44.3333,41.1667 Z "/>
|
||||
</ToggleButton>
|
||||
<ToggleButton Width="25" Height="25">
|
||||
<Path Stretch="Uniform" Fill="#FF000000" Data="F1 M 29,18L 52.25,41.1667L 43.0865,42.6585L 50.817,56.6949L 43.827,60.4115L 36,46.25L 29,53.25L 29,18 Z "/>
|
||||
</ToggleButton>
|
||||
</StackPanel>
|
||||
<GroupBox Header="Vertices" Margin="3" DockPanel.Dock="Top">
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
|
||||
<Button Margin="3" ToolTip="Add random vertex" Name="addVertexButton" Height="50" BorderBrush="{DynamicResource ButtonBorder}">
|
||||
<Path Width="36.6666" Height="36.6667" Stretch="Fill" Fill="{DynamicResource ButtonText}" Data="F1 M 26.9167,38L 31.6667,38L 31.6667,45.9167L 39.5833,45.9167L 39.5833,50.6667L 31.6667,50.6667L 31.6667,58.5833L 26.9167,58.5833L 26.9167,50.6667L 19,50.6667L 19,45.9167L 26.9167,45.9167L 26.9167,38 Z M 38,19C 43.5417,19 45.9167,22.1667 45.1174,28.8134C 45.8315,29.2229 46.3125,29.9928 46.3125,30.875C 46.3125,31.9545 45.5923,32.8658 44.6061,33.1546C 44.1941,34.623 43.5543,35.9229 42.75,36.9628L 42.75,41.9583C 45.3889,42.4861 47.5,42.75 50.6667,44.3333C 53.8333,45.9167 54.8889,47.3681 57,49.4792L 57,57L 33.25,57L 33.25,52.25L 41.1667,52.25L 41.1666,44.3333L 33.25,44.3333L 33.25,36.9628L 33.25,36.4167L 32.8586,36.4167C 32.237,35.4811 31.7366,34.3762 31.3939,33.1546C 30.4077,32.8658 29.6875,31.9545 29.6875,30.875C 29.6875,29.9928 30.1685,29.2229 30.8826,28.8134C 30.0833,22.1667 32.4583,19 38,19 Z M 19,57L 19,52.25L 25.3333,52.25L 25.3333,57L 19,57 Z "/>
|
||||
</Button>
|
||||
<Button Margin="3" ToolTip="Remove selected vertices" Name="addEdgeButton" Height="50" BorderBrush="{DynamicResource ButtonBorder}">
|
||||
<Path Width="36.6666" Height="36.6667" Stretch="Fill" Fill="{DynamicResource ButtonText}" Data="F1 M 23,55L 18,55L 18,50L 21,50L 53,24L 53,21L 58,21L 58,26L 55,26L 23,52L 23,55 Z M 54,22L 54,25L 57,25L 57,22L 54,22 Z M 19,51L 19,54L 22,54L 22,51L 19,51 Z "/>
|
||||
</Button>
|
||||
</StackPanel>
|
||||
</GroupBox>
|
||||
</DockPanel>
|
||||
</Grid>
|
||||
</UserControl>
|
|
@ -0,0 +1,300 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using GraphX;
|
||||
using GraphX.Controls;
|
||||
using GraphX.Models;
|
||||
using ShowcaseApp.WPF.Models;
|
||||
|
||||
namespace ShowcaseApp.WPF.Pages
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for DynamicGraph.xaml
|
||||
/// </summary>
|
||||
public partial class EditorGraph
|
||||
{
|
||||
/// <summary>
|
||||
/// tmp collection to speedup selected vertices search
|
||||
/// </summary>
|
||||
private readonly List<VertexControl> _selectedVertices = new List<VertexControl>();
|
||||
|
||||
public EditorGraph()
|
||||
{
|
||||
InitializeComponent();
|
||||
var dgLogic = new LogicCoreExample();
|
||||
graphArea.LogicCore = dgLogic;
|
||||
graphArea.SetVerticesDrag(true);
|
||||
|
||||
// addVertexButton.Click += addVertexButton_Click;
|
||||
// addEdgeButton.Click += addEdgeButton_Click;
|
||||
|
||||
dgLogic.DefaultLayoutAlgorithm = LayoutAlgorithmTypeEnum.Custom;
|
||||
dgLogic.DefaultOverlapRemovalAlgorithm = OverlapRemovalAlgorithmTypeEnum.None;
|
||||
dgLogic.DefaultEdgeRoutingAlgorithm = EdgeRoutingAlgorithmTypeEnum.None;
|
||||
dgLogic.EdgeCurvingEnabled = true;
|
||||
|
||||
//graphArea.MoveAnimation = AnimationFactory.CreateMoveAnimation(MoveAnimation.Move, TimeSpan.FromSeconds(0.5));
|
||||
//graphArea.MoveAnimation.Completed += MoveAnimation_Completed;
|
||||
//graphArea.VertexSelected += dg_Area_VertexSelected;
|
||||
|
||||
|
||||
zoomCtrl.IsAnimationDisabled = true;
|
||||
ZoomControl.SetViewFinderVisibility(zoomCtrl, Visibility.Visible);
|
||||
|
||||
}
|
||||
|
||||
/* #region Manual edge drawing
|
||||
|
||||
private bool _isInEdMode;
|
||||
private PathGeometry _edGeo;
|
||||
private VertexControl _edVertex;
|
||||
private EdgeControl _edEdge;
|
||||
private DataVertex _edFakeDv;
|
||||
|
||||
void dg_zoomctrl_MouseDown(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
if (!_isInEdMode || _edGeo == null || _edEdge == null || _edVertex == null || e.LeftButton != MouseButtonState.Pressed) return;
|
||||
//place point
|
||||
var pos = dg_zoomctrl.TranslatePoint(e.GetPosition(dg_zoomctrl), dg_Area);
|
||||
var lastseg = _edGeo.Figures[0].Segments[_edGeo.Figures[0].Segments.Count - 1] as PolyLineSegment;
|
||||
if (lastseg != null) lastseg.Points.Add(pos);
|
||||
_edEdge.SetEdgePathManually(_edGeo);
|
||||
}
|
||||
|
||||
void dg_Area_MouseMove(object sender, MouseEventArgs e)
|
||||
{
|
||||
if (!_isInEdMode || _edGeo == null || _edEdge == null || _edVertex == null) return;
|
||||
var pos = dg_zoomctrl.TranslatePoint(e.GetPosition(dg_zoomctrl), dg_Area);
|
||||
var lastseg = _edGeo.Figures[0].Segments[_edGeo.Figures[0].Segments.Count - 1] as PolyLineSegment;
|
||||
if (lastseg != null) lastseg.Points[lastseg.Points.Count - 1] = pos;
|
||||
_edEdge.SetEdgePathManually(_edGeo);
|
||||
}
|
||||
|
||||
void dg_Area_VertexSelectedForED(object sender, VertexSelectedEventArgs args)
|
||||
{
|
||||
if (!_isInEdMode) return;
|
||||
if (_edVertex == null) //select starting vertex
|
||||
{
|
||||
_edVertex = args.VertexControl;
|
||||
_edFakeDv = new DataVertex { ID = -666 };
|
||||
_edGeo = new PathGeometry(new PathFigureCollection { new PathFigure { IsClosed = false, StartPoint = _edVertex.GetPosition(), Segments = new PathSegmentCollection { new PolyLineSegment(new List<Point> { new Point() }, true) } } });
|
||||
var dedge = new DataEdge(_edVertex.Vertex as DataVertex, _edFakeDv);
|
||||
_edEdge = new EdgeControl(_edVertex, null, dedge) { ManualDrawing = true };
|
||||
dg_Area.AddEdge(dedge, _edEdge);
|
||||
dg_Area.LogicCore.Graph.AddVertex(_edFakeDv);
|
||||
dg_Area.LogicCore.Graph.AddEdge(dedge);
|
||||
_edEdge.SetEdgePathManually(_edGeo);
|
||||
}
|
||||
else if (!Equals(_edVertex, args.VertexControl)) //finish draw
|
||||
{
|
||||
_edEdge.Target = args.VertexControl;
|
||||
var dedge = _edEdge.Edge as DataEdge;
|
||||
if (dedge != null) dedge.Target = args.VertexControl.Vertex as DataVertex;
|
||||
var fig = _edGeo.Figures[0];
|
||||
var seg = fig.Segments[_edGeo.Figures[0].Segments.Count - 1] as PolyLineSegment;
|
||||
|
||||
if (seg != null && seg.Points.Count > 0)
|
||||
{
|
||||
var targetPos = _edEdge.Target.GetPosition();
|
||||
var sourcePos = _edEdge.Source.GetPosition();
|
||||
//get the size of the source
|
||||
var sourceSize = new Size
|
||||
{
|
||||
Width = _edEdge.Source.ActualWidth,
|
||||
Height = _edEdge.Source.ActualHeight
|
||||
};
|
||||
var targetSize = new Size
|
||||
{
|
||||
Width = _edEdge.Target.ActualWidth,
|
||||
Height = _edEdge.Target.ActualHeight
|
||||
};
|
||||
|
||||
var srcStart = seg.Points.Count == 0 ? fig.StartPoint : seg.Points[0];
|
||||
var srcEnd = seg.Points.Count > 1 ? (seg.Points[seg.Points.Count - 1] == targetPos ? seg.Points[seg.Points.Count - 2] : seg.Points[seg.Points.Count - 1]) : fig.StartPoint;
|
||||
var p1 = GeometryHelper.GetEdgeEndpoint(sourcePos, new Rect(sourceSize), srcStart, _edEdge.Source.VertexShape);
|
||||
var p2 = GeometryHelper.GetEdgeEndpoint(targetPos, new Rect(targetSize), srcEnd, _edEdge.Target.VertexShape);
|
||||
|
||||
|
||||
fig.StartPoint = p1;
|
||||
if (seg.Points.Count > 1)
|
||||
seg.Points[seg.Points.Count - 1] = p2;
|
||||
}
|
||||
GeometryHelper.TryFreeze(_edGeo);
|
||||
_edEdge.SetEdgePathManually(new PathGeometry(_edGeo.Figures));
|
||||
_isInEdMode = false;
|
||||
ClearEdgeDrawing();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void ClearEdgeDrawing()
|
||||
{
|
||||
_edGeo = null;
|
||||
if (_edFakeDv != null)
|
||||
dg_Area.LogicCore.Graph.RemoveVertex(_edFakeDv);
|
||||
_edFakeDv = null;
|
||||
_edVertex = null;
|
||||
_edEdge = null;
|
||||
}
|
||||
|
||||
private void dg_butdraw_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (!_isInEdMode)
|
||||
{
|
||||
if (dg_Area.VertexList.Count() < 2)
|
||||
{
|
||||
MessageBox.Show("Please add more vertices before proceed with this action!", "Starting to draw custom edge...", MessageBoxButton.OK, MessageBoxImage.Information);
|
||||
return;
|
||||
}
|
||||
MessageBox.Show("Please select any vertex to define edge starting point!", "Starting to draw custom edge...", MessageBoxButton.OK, MessageBoxImage.Information);
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show("Edge drawing mode has been canceled!");
|
||||
if (_edEdge != null)
|
||||
_edEdge.SetEdgePathManually(null);
|
||||
ClearEdgeDrawing();
|
||||
}
|
||||
_isInEdMode = !_isInEdMode;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Dragging example
|
||||
void dg_dragsource_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
var data = new DataObject(typeof(object), new object());
|
||||
DragDrop.DoDragDrop(dg_dragsource, data, DragDropEffects.Link);
|
||||
}
|
||||
|
||||
static void dg_Area_DragEnter(object sender, DragEventArgs e)
|
||||
{
|
||||
//don't show drag effect if we are on drag source or don't have any item of needed type dragged
|
||||
if (!e.Data.GetDataPresent(typeof(object)) || sender == e.Source)
|
||||
{
|
||||
e.Effects = DragDropEffects.None;
|
||||
}
|
||||
}
|
||||
|
||||
void dg_Area_Drop(object sender, DragEventArgs e)
|
||||
{
|
||||
if (!e.Data.GetDataPresent(typeof (object))) return;
|
||||
//how to get dragged data by its type
|
||||
var pos = dg_zoomctrl.TranslatePoint(e.GetPosition(dg_zoomctrl), dg_Area);
|
||||
var data = new DataVertex("Vertex " + (dg_Area.VertexList.Count() + 1));
|
||||
dg_Area.LogicCore.Graph.AddVertex(data);
|
||||
var vc = new VertexControl(data);
|
||||
dg_Area.AddVertex(data, vc);
|
||||
GraphAreaBase.SetX(vc, pos.X);
|
||||
GraphAreaBase.SetY(vc, pos.Y, true);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
private void SelectVertex(VertexControl vc)
|
||||
{
|
||||
if (_selectedVertices.Contains(vc))
|
||||
{
|
||||
_selectedVertices.Remove(vc);
|
||||
HighlightBehaviour.SetHighlighted(vc, false);
|
||||
DragBehaviour.SetIsTagged(vc, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
_selectedVertices.Add(vc);
|
||||
HighlightBehaviour.SetHighlighted(vc, true);
|
||||
DragBehaviour.SetIsTagged(vc, true);
|
||||
}
|
||||
}
|
||||
|
||||
void graphArea_VertexSelected(object sender, VertexSelectedEventArgs args)
|
||||
{
|
||||
if (args.MouseArgs.LeftButton == MouseButtonState.Pressed)
|
||||
{
|
||||
if (Keyboard.IsKeyDown(Key.LeftCtrl))
|
||||
SelectVertex(args.VertexControl);
|
||||
}
|
||||
else if (args.MouseArgs.RightButton == MouseButtonState.Pressed)
|
||||
{
|
||||
args.VertexControl.ContextMenu = new ContextMenu();
|
||||
var mi = new MenuItem { Header = "Delete item", Tag = args.VertexControl };
|
||||
mi.Click += mi_Click;
|
||||
args.VertexControl.ContextMenu.Items.Add(mi);
|
||||
}
|
||||
}
|
||||
|
||||
void mi_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var menuItem = sender as MenuItem;
|
||||
if (menuItem == null) return;
|
||||
var vc = menuItem.Tag as VertexControl;
|
||||
if (vc != null) SafeRemoveVertex(vc, true);
|
||||
}
|
||||
|
||||
void dg_remedge_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (!dg_Area.EdgesList.Any()) return;
|
||||
dg_Area.LogicCore.Graph.RemoveEdge(dg_Area.EdgesList.Last().Key);
|
||||
dg_Area.RemoveEdge(dg_Area.EdgesList.Last().Key);
|
||||
}
|
||||
|
||||
private EditorMode EditorMode;
|
||||
void addEdgeButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if(EditorMode == EditorMode.AddEdge)
|
||||
{
|
||||
EditorMode = EditorMode.None;
|
||||
_selectedVertices.ForEach(SelectVertex);
|
||||
return;
|
||||
}
|
||||
EditorMode = EditorMode.AddEdge;
|
||||
|
||||
}
|
||||
|
||||
private void SafeRemoveVertex(VertexControl vc, bool removeFromSelected = false)
|
||||
{
|
||||
//remove all adjacent edges
|
||||
foreach (var ec in dg_Area.GetRelatedControls(vc, GraphControlType.Edge, EdgesType.All).OfType<EdgeControl>()) {
|
||||
dg_Area.LogicCore.Graph.RemoveEdge(ec.Edge as DataEdge);
|
||||
dg_Area.RemoveEdge(ec.Edge as DataEdge);
|
||||
}
|
||||
dg_Area.LogicCore.Graph.RemoveVertex(vc.Vertex as DataVertex);
|
||||
dg_Area.RemoveVertex(vc.Vertex as DataVertex);
|
||||
if (removeFromSelected && _selectedVertices.Contains(vc))
|
||||
_selectedVertices.Remove(vc);
|
||||
dg_zoomctrl.ZoomToFill();
|
||||
|
||||
}
|
||||
|
||||
void addVertexButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var data = new DataVertex();
|
||||
ThemedDataStorage.FillDataVertex(data);
|
||||
|
||||
dg_Area.LogicCore.Graph.AddVertex(data);
|
||||
dg_Area.AddVertex(data, new VertexControl(data));
|
||||
|
||||
//we have to check if there is only one vertex and set coordinates manulay
|
||||
//because layout algorithms skip all logic if there are less than two vertices
|
||||
if (dg_Area.VertexList.Count() == 1)
|
||||
dg_Area.VertexList.First().Value.SetPosition(0, 0);
|
||||
else dg_Area.RelayoutGraph(true);
|
||||
dg_zoomctrl.ZoomToFill();
|
||||
}
|
||||
*/
|
||||
|
||||
}
|
||||
|
||||
public enum EditorMode
|
||||
{
|
||||
None = 0,
|
||||
AddEdge,
|
||||
AddVertex
|
||||
}
|
||||
}
|
|
@ -76,10 +76,6 @@
|
|||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\packages\YAXLib.2.13\lib\YAXLib.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="YAXLib.PCL.Common, Version=1.0.0.0, Culture=neutral, PublicKeyToken=dcbed8d9a3a2cf04, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>bin\Release\YAXLib.PCL.Common.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ApplicationDefinition Include="App.xaml">
|
||||
|
@ -129,6 +125,10 @@
|
|||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Pages\EditorGraph.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Include="Pages\DynamicGraph.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
|
@ -157,6 +157,10 @@
|
|||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Templates\EditorGraphXTemplates.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Include="Templates\DynamicGraphXTemplates.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
|
@ -192,6 +196,7 @@
|
|||
</Compile>
|
||||
<Compile Include="Models\ColorModel.cs" />
|
||||
<Compile Include="Models\DataItem.cs" />
|
||||
<Compile Include="Models\EditorObjectManager.cs" />
|
||||
<Compile Include="Models\ImageLoader.cs" />
|
||||
<Compile Include="Models\ShadowChrome.cs" />
|
||||
<Compile Include="Models\ShowcaseHelper.cs" />
|
||||
|
@ -202,6 +207,9 @@
|
|||
<Compile Include="Pages\DebugGraph.xaml.cs">
|
||||
<DependentUpon>DebugGraph.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Pages\EditorGraph.xaml.cs">
|
||||
<DependentUpon>EditorGraph.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Pages\DynamicGraph.xaml.cs">
|
||||
<DependentUpon>DynamicGraph.xaml</DependentUpon>
|
||||
</Compile>
|
||||
|
|
|
@ -0,0 +1,146 @@
|
|||
<ResourceDictionary
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:po="http://schemas.microsoft.com/winfx/2006/xaml/presentation/options"
|
||||
xmlns:gxl="clr-namespace:GraphX;assembly=GraphX.WPF.Controls"
|
||||
xmlns:conv="clr-namespace:GraphX.Converters;assembly=GraphX.WPF.Controls">
|
||||
|
||||
<LinearGradientBrush x:Key="NormalBrush" EndPoint="0.5,1" StartPoint="0.5,0" po:Freeze="true">
|
||||
<GradientStop Color="#FFFFFFFF" Offset="0"/>
|
||||
<GradientStop Color="#FFA4ADBB" Offset="0.521"/>
|
||||
<GradientStop Color="#FFD7E0EA" Offset="0.194"/>
|
||||
<GradientStop Color="#FFBAC1CF" Offset="0.811"/>
|
||||
<GradientStop Color="#FFBCC5D5" Offset="0.507"/>
|
||||
<GradientStop Color="#FFE3E4E6" Offset="1"/>
|
||||
</LinearGradientBrush>
|
||||
<LinearGradientBrush x:Key="NormalBorderBrush" EndPoint="0.5,0" StartPoint="0.5,1" po:Freeze="true">
|
||||
<GradientStop Color="#FF8B8B8B"/>
|
||||
<GradientStop Color="#FFADADAD" Offset="1"/>
|
||||
</LinearGradientBrush>
|
||||
|
||||
<LinearGradientBrush x:Key="EdgeBrush" EndPoint="0.5,0" StartPoint="0.5,1" po:Freeze="true">
|
||||
<GradientStop Color="#FF000000"/>
|
||||
<GradientStop Color="#FFBF931E" Offset="1"/>
|
||||
</LinearGradientBrush>
|
||||
|
||||
<SolidColorBrush x:Key="EdgeArrowBrush" Color="Black" po:Freeze="true" />
|
||||
|
||||
<!-- VERTEX CONTROL -->
|
||||
<Style TargetType="{x:Type gxl:VertexControl}">
|
||||
<!-- Set background color through attached property -->
|
||||
<Setter Property="Background" Value="{StaticResource NormalBrush}"/>
|
||||
<Setter Property="Padding" Value="10,5,10,5"/>
|
||||
<Setter Property="BorderBrush" Value="{StaticResource NormalBorderBrush}"/>
|
||||
<Setter Property="BorderThickness" Value="3"/>
|
||||
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type gxl:VertexControl}">
|
||||
<ControlTemplate.Resources>
|
||||
<Storyboard x:Key="HoverOn">
|
||||
<DoubleAnimation Duration="00:00:00.1000000" Storyboard.TargetName="BackgroundOver" Storyboard.TargetProperty="Opacity" To="1" />
|
||||
<DoubleAnimation Duration="00:00:00.1000000" Storyboard.TargetName="BackgroundOver_Highlight" Storyboard.TargetProperty="Opacity" To="0.65" />
|
||||
</Storyboard>
|
||||
<Storyboard x:Key="HoverOff">
|
||||
<DoubleAnimation Duration="00:00:00.4000000" Storyboard.TargetName="BackgroundOver" Storyboard.TargetProperty="Opacity" To="0" />
|
||||
<DoubleAnimation Duration="00:00:00.4000000" Storyboard.TargetName="BackgroundOver_Highlight" Storyboard.TargetProperty="Opacity" To="0" />
|
||||
</Storyboard>
|
||||
</ControlTemplate.Resources>
|
||||
|
||||
<Grid>
|
||||
<Border x:Name="BackgroundNorm" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="5" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}"/>
|
||||
<Border x:Name="BackgroundNorm_highlight" Margin="1" BorderBrush="{DynamicResource NormalHighlightBrush}" BorderThickness="1,0,1,1" CornerRadius="5" Opacity="0.65" />
|
||||
<Border x:Name="BackgroundOver" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="5" Opacity="0" Background="{DynamicResource MouseOverBrush}" BorderBrush="{DynamicResource MouseOverBorderBrush}"/>
|
||||
<Border x:Name="BackgroundOver_Highlight" Margin="1" BorderThickness="1,0,1,1" CornerRadius="5" Opacity="0" BorderBrush="{DynamicResource MouseOverHighlightBrush}"/>
|
||||
|
||||
<Grid UseLayoutRounding="True" SnapsToDevicePixels="True">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition/>
|
||||
<RowDefinition/>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Image Source="{Binding PersonImage}" Margin="3" Width="60" Stretch="UniformToFill" Grid.RowSpan="2"/>
|
||||
<TextBlock Text="{Binding Name}" VerticalAlignment="Center" FontWeight="Bold" Foreground="Black" Grid.Column="1" Grid.Row="0" Margin="3" MinWidth="120"/>
|
||||
<TextBlock Text="{Binding Profession}" TextAlignment="Center" FontStyle="Italic" FontSize="14" VerticalAlignment="Center" HorizontalAlignment="Center" Foreground="White" Grid.Column="1" Grid.Row="1" Margin="3"/>
|
||||
</Grid>
|
||||
</Grid>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="true">
|
||||
<Trigger.ExitActions>
|
||||
<BeginStoryboard Storyboard="{StaticResource HoverOff}" x:Name="HoverOff_BeginStoryboard" />
|
||||
</Trigger.ExitActions>
|
||||
<Trigger.EnterActions>
|
||||
<BeginStoryboard Storyboard="{StaticResource HoverOn}" />
|
||||
</Trigger.EnterActions>
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
|
||||
</Setter>
|
||||
|
||||
<!-- VERTEX DRAGGING CONTROL -->
|
||||
<Setter Property="gxl:DragBehaviour.IsDragEnabled"
|
||||
Value="False" />
|
||||
<Setter Property="gxl:DragBehaviour.UpdateEdgesOnMove"
|
||||
Value="True" />
|
||||
|
||||
|
||||
<Style.Triggers>
|
||||
<Trigger Property="gxl:HighlightBehaviour.Highlighted" Value="True">
|
||||
<Setter Property="BorderBrush" Value="Gold"/>
|
||||
<Setter Property="BorderThickness" Value="7"/>
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
|
||||
</Style>
|
||||
|
||||
|
||||
<!-- EDGE CONTROL -->
|
||||
<Style TargetType="{x:Type gxl:EdgeControl}">
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type gxl:EdgeControl}">
|
||||
<Grid>
|
||||
<Path Stroke="{StaticResource EdgeBrush}"
|
||||
StrokeThickness="2" MinWidth="1" MinHeight="1"
|
||||
ToolTip="{TemplateBinding ToolTip}"
|
||||
x:Name="PART_edgePath"/>
|
||||
<Path Stroke="{StaticResource EdgeArrowBrush}"
|
||||
StrokeThickness="2" MinWidth="1" MinHeight="1"
|
||||
x:Name="PART_edgeArrowPath"/>
|
||||
</Grid>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
|
||||
<Setter Property="MinWidth"
|
||||
Value="1" />
|
||||
<Setter Property="MinHeight"
|
||||
Value="1" />
|
||||
<Setter Property="Background"
|
||||
Value="Red" />
|
||||
<Setter Property="Foreground"
|
||||
Value="Silver" />
|
||||
<Setter Property="Opacity"
|
||||
Value="1" />
|
||||
|
||||
<Setter Property="gxl:HighlightBehaviour.IsHighlightEnabled" Value="False"/>
|
||||
|
||||
|
||||
<Style.Triggers>
|
||||
<Trigger Property="gxl:HighlightBehaviour.Highlighted" Value="True">
|
||||
<Setter Property="Foreground" Value="Gold"/>
|
||||
<Setter Property="StrokeThickness" Value="5"/>
|
||||
</Trigger>
|
||||
<Trigger Property="gxl:HighlightBehaviour.Highlighted" Value="False ">
|
||||
<Setter Property="Foreground" Value="Silver"/>
|
||||
<Setter Property="StrokeThickness" Value="2"/>
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
|
||||
</ResourceDictionary>
|
|
@ -12,7 +12,7 @@
|
|||
<requireLicenseAcceptance>false</requireLicenseAcceptance>
|
||||
<description>GraphX for .NET is an advanced open-source graph visualization library that uses different layout and edge routing algorithms, implements many graph-related features and supports highly customizable visual templates. It is able to render large amount of vertices and steadily moves to support the most popular .NET platforms.</description>
|
||||
<releaseNotes>https://github.com/panthernet/GraphX/blob/PCL/Documents/CHANGELOG.txt</releaseNotes>
|
||||
<copyright>Copyright 2015</copyright>
|
||||
<copyright>Copyright www.panthernet.ru 2015</copyright>
|
||||
<tags>GraphX WPF Graph# QuickGraph graph visualization</tags>
|
||||
</metadata>
|
||||
</package>
|
Загрузка…
Ссылка в новой задаче