oaz / avaloniagraphcontrol Goto Github PK
View Code? Open in Web Editor NEWA graph layout panel for AvaloniaUI
Home Page: https://oaz.github.io/AvaloniaGraphControl/
License: Other
A graph layout panel for AvaloniaUI
Home Page: https://oaz.github.io/AvaloniaGraphControl/
License: Other
State Machine Many Composites (Horizontal) in the sample app crashes sometimes. Exception comes from MSAGL. I'm using the latest version of MSAGL from github.
The crash doesn't happen every time I select this graph, but it happens often.
Hi.
I want to be able to color some edges in my graph differently. I've found that it's possible to change the color of all edges using Styles, but I haven't figured out how to color an edge separately. Please enlighten me, if you have the solution.
If not, I propose that we expand the Edge class to take a brush color and use that in the Connection class for setting the Brush property. I can submit a pull request if you think it's a good idea. Please say so if you think another approach is needed.
Regards, Kristian.
I would like to add a context menu to remove edges.
I'm not sure if it is the best way, but I added this to the GraphPanel:
<agc:GraphPanel.DataTemplates>
<DataTemplate DataType="{x:Type agc:Edge}">
<agc:Connection>
<agc:Connection.ContextMenu>
<ContextMenu>
<MenuItem Command="{Binding $parent.DataContext.RemoveEdge}" CommandParameter="{Binding}" Header="Remove edge"/>
</ContextMenu>
</agc:Connection.ContextMenu>
</agc:Connection>
</DataTemplate>
</agc:GraphPanel.DataTemplates>
The binding to a method works if I use the code behind and Click="MyMethod", but how do I bind to a view model method (with the xaml above, the context menu item is disabled)?
When I use Command="{Binding RemoveEdge}", the menu item is enabled, but the viewmodel method doesn't get called.
I need to pass the edge somehow as parameter. With the code behind approach the Edge is the DataContext property of MenuItem (which is the sender:
public void MyMethod(object sender, Avalonia.Interactivity.RoutedEventArgs e)
{
}
Another question is if it is possible to specify the thickness of the connection line? I only saw a Brush property. Since the line is pretty thin it would be helpful to make it a bit thicker on hover.
In MSAGL, it allows you to drag and drop/ move the nodes around. With this it doesn't seem to let me. Is there anything I can add to allow me to do that?
Hi, thanks for this great project ๐ I just have an issue when using it as a child of ScrollViewer
, e.g. when modifying MainWindow.xaml
in the sample the following way:
...
</StackPanel>
<ScrollViewer Grid.Column="0" Grid.Row="1">
<agc:GraphPanel Background="WhiteSmoke" Graph="{Binding SelectedItem, ElementName=graphs}" Zoom="{Binding Value, ElementName=zoomer}" LayoutMethod="{Binding SelectedItem, ElementName=layoutMethods}">
...
</agc:GraphPanel>
</ScrollViewer>
</Grid>
...
The following exception is thrown:
System.InvalidOperationException
HResult=0x80131509
Message=Invalid size returned for Measure.
Source=Avalonia.Layout
StackTrace:
at Avalonia.Layout.Layoutable.Measure(Size availableSize)
at Avalonia.Controls.Presenters.ScrollContentPresenter.MeasureOverride(Size availableSize)
at Avalonia.Layout.Layoutable.MeasureCore(Size availableSize)
at Avalonia.Layout.Layoutable.Measure(Size availableSize)
at Avalonia.Controls.Grid.MeasureCell(Int32 cell, Boolean forceInfinityV)
at Avalonia.Controls.Grid.MeasureCellsGroup(Int32 cellsHead, Size referenceSize, Boolean ignoreDesiredSizeU, Boolean forceInfinityV, Boolean& hasDesiredSizeUChanged)
at Avalonia.Controls.Grid.MeasureOverride(Size constraint)
at Avalonia.Layout.Layoutable.MeasureCore(Size availableSize)
at Avalonia.Layout.Layoutable.Measure(Size availableSize)
at Avalonia.Layout.Layoutable.MeasureOverride(Size availableSize)
at Avalonia.Layout.Layoutable.MeasureCore(Size availableSize)
at Avalonia.Layout.Layoutable.Measure(Size availableSize)
at Avalonia.Controls.Grid.MeasureCell(Int32 cell, Boolean forceInfinityV)
at Avalonia.Controls.Grid.MeasureCellsGroup(Int32 cellsHead, Size referenceSize, Boolean ignoreDesiredSizeU, Boolean forceInfinityV, Boolean& hasDesiredSizeUChanged)
at Avalonia.Controls.Grid.MeasureOverride(Size constraint)
at Avalonia.Layout.Layoutable.MeasureCore(Size availableSize)
at Avalonia.Layout.Layoutable.Measure(Size availableSize)
at Avalonia.Layout.LayoutHelper.MeasureChild(ILayoutable control, Size availableSize, Thickness padding)
at Avalonia.Layout.LayoutHelper.MeasureChild(ILayoutable control, Size availableSize, Thickness padding, Thickness borderThickness)
at Avalonia.Controls.Presenters.ContentPresenter.MeasureOverride(Size availableSize)
at Avalonia.Layout.Layoutable.MeasureCore(Size availableSize)
at Avalonia.Layout.Layoutable.Measure(Size availableSize)
at Avalonia.Layout.LayoutHelper.MeasureChild(ILayoutable control, Size availableSize, Thickness padding)
at Avalonia.Controls.Primitives.VisualLayerManager.MeasureOverride(Size availableSize)
at Avalonia.Layout.Layoutable.MeasureCore(Size availableSize)
at Avalonia.Layout.Layoutable.Measure(Size availableSize)
at Avalonia.Layout.LayoutHelper.MeasureChild(ILayoutable control, Size availableSize, Thickness padding)
at Avalonia.Layout.LayoutHelper.MeasureChild(ILayoutable control, Size availableSize, Thickness padding, Thickness borderThickness)
at Avalonia.Controls.Border.MeasureOverride(Size availableSize)
at Avalonia.Layout.Layoutable.MeasureCore(Size availableSize)
at Avalonia.Layout.Layoutable.Measure(Size availableSize)
at Avalonia.Layout.Layoutable.MeasureOverride(Size availableSize)
at Avalonia.Controls.Window.MeasureOverride(Size availableSize)
at Avalonia.Controls.WindowBase.MeasureCore(Size availableSize)
at Avalonia.Layout.Layoutable.Measure(Size availableSize)
at Avalonia.Layout.LayoutManager.Measure(ILayoutable control)
at Avalonia.Layout.LayoutManager.ExecuteInitialLayoutPass(ILayoutRoot root)
at Avalonia.Controls.Window.Show()
at Avalonia.Controls.ApplicationLifetimes.ClassicDesktopStyleApplicationLifetime.Start(String[] args)
at Avalonia.ClassicDesktopStyleApplicationLifetimeExtensions.StartWithClassicDesktopLifetime[T](T builder, String[] args, ShutdownMode shutdownMode)
at AvaloniaGraphControlSample.Program.Main(String[] args) in C:\iolevel\playground\AvaloniaGraphControl\sample\Program.cs:line 13
I'll attach a PR which should fix it.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.