Jump to content

Most Liked Content

#39 GraphX v2 - PCL, Silverlight and more.

Posted by Alexander Smirnov on 09 December 2013 - 02:38 PM

Yes, i've decided to name it GraphX v2 at the moment :) From the current milestone i see following features that makes difference:

  • Separate libraries design - all algorithms and logic are in the standalone library that can be used separately from GraphX.
  • PCL version - portable compact libraries can be hot-referenced in Windows (Framework 4.0), Silverlight 5, WindowsPhone 8 and Windows 8 applications.
  • Silverlight platform support


There is no alpha at the moment but if you are interested, you can contribute by following matters:

  • PM me if you have any cool zoom control library for Silverlight. It is real pain to transfer ZoomBox to silverlight :)
  • PM me if you're interested in Silverlight XAML animation and visualization development. Well, some SL limitations is a pain for me :)

  • taurenshaman and kindrashunt like this

#956 Elliptical vertexes and edge connections

Posted by Alexander Smirnov on 27 August 2015 - 09:25 AM

Oh, sorry that i've misinformed you. Just checked it more closely and found that it works only for circles. I've already implemented VertexShape.Ellipse math shape in the latest sources update on GitHub, please check it and see if everything is fine.

  • persalmi likes this

#95 ShowcaseExample thrown an exception when moving frame in ViewFinder

Posted by Alexander Smirnov on 21 January 2014 - 03:30 PM

Fixed and updated sources. It seems the event route is different using canvas.... need to test it further to make sure that the order will not be changed anymore.

  • yoshka likes this

#837 List<DataVertex> in DataVertex class -> Vertex tree

Posted by Alexander Smirnov on 04 June 2015 - 09:04 PM

Hi! To specify relations between vertices you have to add DataEdge objects to the graph which takes Source and Target vertices params. When you can set GraphArea::LogicCore.DefaultLayoutAlgorithm to Tree algorithm and run GraphArea::GenerateGraph(true) method to generate graph. After that you can handel VertexControl click event of the GraphArea object and get currently clicked vertex to find its relations and make all others invisible.

P.S. Sorry, can't see the code right now and give you detailed object names and instructions.
  • Alexander Smirnov likes this

#823 [2.1.9] KK, LinLog, and ISOM layout Algorithms broken

Posted by Alexander Smirnov on 27 May 2015 - 01:21 PM

Yeah, it's better to wait for final release if you plan to upgrade GraphX version. The upgrade is all about changing namespace usings, other changes are exceptional in most cases.

  • smithmonkey likes this

#781 Различная подсветка узлов и ребер.

Posted by Alexander Smirnov on 18 May 2015 - 08:38 AM

Здравствуйте.  Самый простой способ - задать отдельное свойство для DataVertex или DataEdge классов данных (например Color) и привязать (Bind) к нему шаблоны VertexControl и/или EdgeControl в XAML шаблоне.

За подсветку отвечает behaviour типа HighlightBehaviour, настраиваемый в упомянутых шаблонах.

Например, установка цвета выделения может быть указана так (посмотрите инфу здесь):

            <Trigger Property="controls:HighlightBehaviour.Highlighted" Value="True">
                <Setter Property="BorderBrush" Value="{Binding Path=Color}"/>
                <Setter Property="BorderThickness" Value="7"/>

где, вместо Gold задается привязка к свойству класса данных. Т.к. Color В данном случае имеет тип Brush, более корректным вариантом будет создание свойства Color в примитивном типе (int, enum, string), а в привязке сделать преобразование примитивного типа в Brush при помощи конвертера привязок, например:

Value="{Binding Path=Color, Converter={StaticResource ColorToBrushConverter}}"

Конвертер, в данном случае, придется написать самому или найти в интернете. Пример пользования конвертера для привязок можно поискать в проекте ShowcaseApp.WPF.

  • Gorodeckiy likes this

#747 Displaying Edge Labels

Posted by Alexander Smirnov on 01 April 2015 - 03:36 PM

To be honest, I've only looked at code for 2.0.2. I probably have a lot to catch up with... 

Yeah there are some changes, but it still looks almost the same. The one big thing happend is that i've splitted the code into different assemblies for PCL compatibility :) Feel free to ask any questions and i hope you'll contribute to the project in some way :)

  • jorgen likes this

#496 MVVM Example?

Posted by Alexander Smirnov on 20 November 2014 - 02:54 PM

Here is an example project i tested the behaviour on: https://www.dropbox....m_test.rar?dl=0


All seems to work fine for me, maybe some WAF specifics spoils the fun. You can press Random button to generate graph from UI or press Action button to make the 'dirty' call to VM to regenerate its LogicCore which will trigger following events:

1. VM will fire ModelChanged event which will be successfully catched by the View

2. View will call GraphArea.GenerateGraph() to regenerate graph visualization

  • strive likes this

#44 Monogame/XNA Examples v2.0

Posted by Alexander Smirnov on 16 December 2013 - 04:08 PM

Let me introduce a series of essential monogame/XNA tutorials and examples that are definetly will come in handy for the begginers. I've planned this stuff a while ago, so it will be updated from time to time as my own research in the area goes on (and of cause i have some free time). 
If you have any suggestions or ideas about my examples please feel free to discuss them. This work is my open-source contribution to the community.
The current version of examples solution includes the following:

  • Independent resolution renderer (IRR). One of the main cross-platform development problems is the problem of optimization of the displayed content on the variety of different devices with different screen resolutions. IRR is one of the simpliest solutions for such problems. It automaticaly scales rendered content according to custom "virtual" screen resolution maintaining defined screen width/height ratio. Though huge scales probably can cripple your textures it is possible to implement additional techniques to load different sets of the textures (high res/low res)  for different resolution ranges. This IRR is based on the work of other author (all copyrights are preserved) but modified for better usability and features support. Be sure that it will be updated to better accomodate all of the example projects.


- Screen auto scaling to fit any resolution with any aspect ratio

- Single virtual screen resolution space that makes you to store only one coordinates set valid for all resolutions

- Easy objects selection and coordinates conversion

  • UI Designer Component. By the time i've spent making my first game i've runned into the small but nasty problem. This is the problem of making the good looking UI with ease and this is the problem even in case you already have some nice textures. My little component saves your time by allowing you to place a list of textures on the screen and arranges them as you like alowing to change texture position and size. After the composition is done you can copy pos and size data for each texture right into the clipboard (Thanks WinForms!). And bear in mind that if we'll use IRR from the first example we get virtual coordinates that are valid for all resolutions at once.  Recently, i've also added helper WinForms window that provides easy textures and names management, now you can load/remove/dupe textures on the fly and generate coordinates code for all textures at once. Nice? I bet it is! :)

- Load/remove/duplicate textures on the fly from source images

- Place and resize textures using mouse, keyboard and input fields

- Change textures drawing order, names and coordinats using WF support window

- Get generated textures rectangle code right into your clipboard

- Compatible with independent resolution renderer

  • Advanced Camera2D. A must have for any 2D game! Camera2D concept allows to perform common zoom, pan and rotate operations on all textures that is drawn using this camera. My camera example also provides additional features such as smooth camera transition to coordinates, smooth coordinates follow logic and rectangle area zoom. This camera is intended to be used with IRR so basicaly the order of coordinates transformation is: IRR matrix -> Camera matrix -> Onscreen result!

- Zoom, pan and rotate affected textures

- Smooth transition to specified position

- Smooth object follow camera using transition

- Zoom to rectangle area

- Easy objects selection and coordinates conversion

- Compatible with independent resolution renderer


  • Sprites example. Sprite class is commonly used to incorporate and make easier different operations with the textures. This is my own implementation of Sprite class that provides such features as:

- Multiple textures storage each with own properties such as Visibility, Scale, Rotation, Origin, Transparency, Depth, etc.

- Different texture types: SpriteTexture (used as the main texture ) and DecalTexture (used as the decoration texture that is bound to sprite rectangle and scaled/rotated automaticaly)

- Interface based structure that allows to easily implement different sprite classes (TODO: SimpleSprite and AnimationSprite examples)


  • Particles example. Particles will come in handy when you decide to make some nice special effects for you game. For example gun/laser shots, smoke, rocket trails and explosion. Possibilities are limitless. In this example there are a couple of classes that are compiled in a mini particles engine that performs centralized particle logics handling and takes care of basic stuff like particle update/disposing and universal rendering. Also there are some custom logic classes included for different special effects. Component classes are:

- ParticlesManager - static class that manages particle logic objects and draws particles.

- ParticlesLogic - base abstract class for custom logic object that implements particles storage, TTL tracking and handles particles creation using input properties.

- Particle - particle class that contains all basic particle properties such as Texture, Position, Direction, etc.


Some helper classes that will be definetly improved with more examples to come:

  • InputHelper class. Simplifies input management for a variety of devices across many platforms. You can see its actual usage in my examples. Some parts of the code i've got somewhere from the web, unfortunately i don't remember where exactly...
  • ResolutionRenderer class. So its the same IRR from the first example used in all my examples.
  • Extensions class. Holds different extension methods for monogame classes. Mostly SpriteBatch class extensions for method calls simplification.

Version history



  • MarinaNeiz likes this

#432 MVVM Example?

Posted by ggblake on 20 September 2014 - 02:28 PM

I'm using GraphX to generate a Rule Based Expert System. I have used MVVC with no issues in implementing the Graph itself.

If there is any interest I can post the code.

  • vickailiu likes this

#409 Development blog & recent changes (Twitter also)

Posted by Alexander Smirnov on 17 July 2014 - 07:46 AM

For the past time there was almost only bugfixes with the one exception: I've almost finished basic version of GraphX for Metro :)

  • Riva likes this

#386 Displaying Edge Labels

Posted by Riva on 24 June 2014 - 01:00 AM

GraphX does support edge labels.

It seems that by default EdgeLabelControl doesn't have a (visible) Control Template assigned, so it's there, but it displays nothing and we can't see it. (Please Panther correct me if I'm wrong.)

To make it visible you have to define a Template for it in XAML, in some ResourceDictionary file. Like so:



<Style TargetType="{x:Type graphxctrls:EdgeLabelControl}">
    <Setter Property="Foreground" Value="Black" />
    <Setter Property="Template">
            <ControlTemplate TargetType="{x:Type graphxctrls:EdgeLabelControl}">
                    <Border Background="LightGray" CornerRadius="8">
                        <ContentPresenter Margin="3" TextBlock.TextAlignment="Center" />


You can find out this, and more, by looking at sources of Example projects in GraphX source.

GraphX doesn't seem to have much of documentation / tutorial for this kind of stuff (being a one-man free project).

  • Riva likes this

#365 Custom vertex controls with GenerateGraph

Posted by Alexander Smirnov on 06 June 2014 - 08:22 AM

PS: If you want to use your own VertexControl classes you must handle them manualy as automated procedures do not know when they nees to create different VertexControl types. In case of automatic procedures (generation methods) you must implement different templates using XAML styles (preferably) or direct code injection.


That is not true anymore :) You can use GraphArea.ControlFactory to define your own control factory that will generate custom vertex control objects derived from VertexControl.

  • zephyr31 likes this

#346 GraphX library PCL version - INFO & DISCUSSION

Posted by Alexander Smirnov on 15 May 2014 - 09:59 PM

I've made some research in PCL a while ago and now i've come to the need to port GraphX to PCL-compliant format to be able to use it with a wider range of Microsoft platforms. The task itself is quite complicated so i felt the need to share the info on the progress and porting results with the community. You can find new PCL BRANCH in GitHub repository (can be broken from time to time as it is WIP branch).


Currently the following specifications are supported/required for the PCL version (logic and common libs only):

  • Min requirement and support: .NET framework v4.0.3 (not common enough but supported in WinXP, needed for enchanced PCL features such as LINQ support)
  • Min support: Siverlight 4 and above
  • Min support: Windows Phone 8
  • Min support: Windows Metro 8


As you may already be familiar with the PCL concept it is clear that we need to do the following:

  • Globaly convert GraphX to PCL compliant format (preserving all current features) so i have to maintain only one library version
  • Convert GraphX.Common and GraphX.Logic to PCL
  • Implement GraphX.Controls library for each platform individualy (first of all Windows Desktop version has to be reworked)

For the moment i've successfuly finished most of the work (hopefuly without the major breaking changes) and currently i'm looking for an additional library optimization and feature isolations.


So far the following solutions has been implemented:

  1. Implemented custom Semaphore class to use in EdgeBundling technique
  2. Implemented custom IClonable interface for some classes that use cloning
  3. Moved latest YAXlib project into the solution and splitted it into PCL and non-PCL projects to be able to use field attributes and custom serializers in PCL libraries
  4. Implemented custom classes from System.Windows namespace: Point, Rect, Size, Vector
  5. Removed Debug calls
  6. Removed HighResolutionTime class from PathFinder edge routing as it used DLL injection and unsafe code
  7. Implemented workaround for some PCL non-compliant code such as LINQ extensions
  8. *Moved MathHelper class to Controls library as it is primarily used for visuals and doing this helps to avoid excessive type conversions
  9. Implemented IGraphControl.SetPosition(double x, double y) method to avoid some type conversions
  10. Solved file operations problem by introducing IFileServiceProvider interface and corresponding property in GXLogicCore class. The implementation of this interface is platform specific so it must be implemented for each platform separately. Good news is that when you assign LogicCore property of the GraphArea the new default (platform-specific) FileServiceProvider is created and assigned to LogicCore automaticaly. This approach helps to avoid breaking changes so you can use general file operation methods as you've used them before. Additionaly this approach allows you to easily implement custom type serialization (or use 3rd party serialization libraries).

Discussion of current problems and approaches:

  1. I've decided to implement my own System.Windows types (as default ones are not supported in PCL) that are used throughout the libraries and this decision leads me to a massive rework of GraphX.Controls library. I have to implement type conversions wisely to avoid heavy impact on the performance (custom type <-> original System.Windows type). That is the most important problem for now that has to be solved correctly, so that is why it would be nice to hear some opinions on the matter. Currently i see two possible ways to solve it: a) Completely rework library to eliminate that types usage in PCL B) Implement type conversions before-set/after-get values in visuals ops
  2. YAXLib serialization is currently located in GXCore and has to be moved somewhere in platform dependent library as it uses reflection which is unsupported in PCL.
  3. Do we realy need Silverlight 4 support? I'm no pro in SL so i can't tell it for sure. If we target Silverlight 5 as minimum requirement we can get the following platforms supported: a) Windows Phone 8.1 B) Xamarin Android c) Xamarin iOS

That is all i've got now. Hope to see some feedback. Thanks!

  • MarinaNeiz likes this

#329 GraphX for .NET v 2.0.2 released

Posted by Alexander Smirnov on 06 May 2014 - 12:30 PM

Most notable addition to GraphX in this release are vertex lables implementation and Nuget dependencies support.

All other changes mostly consist of bug fixes and misc improvements.

Change log:

+ Added vertex control labels with following functionality:
+ 2 available positioning modes: by sides or by coordinates
+ Always attached to vertex and moves with it
+ Rotation angle support
+ Same template logic as in EdgeLabelControl
+ Added key modifiers to vertex event args
+ Added XAML templates usage example in WF project
+ Added new layout type Custom. When set layout algorithm calculation is skipped completely and manually added data is used for OR and ER algorithms (if any).
+ Added (reintroduced) GraphArea::SideExpansionSize property which gets or sets additional space for GraphArea borders. Useful for zoom adjustments when custom text or controls which are not used in size calculations must fit into the zooming.
+ Added IGraphControlFactory-Interface and Implementation for Edge and Vertex controls creation (thanks to Paul Mandalka)
+ Added simple Nuget-Package specification for GraphX (use createPackage.bat to create the nuget package for GraphX) (thanks to Paul Mandalka)
+ Added new ZoomControl::ZoomAnimationCompleted event (thanks to Paul Mandalka)
+ Fixed hidden edges update on vertex drag
+ Fixed PrintHelper::ExportToImage method to use DPI-Settings for Image Rendering (thanks to Paul Mandalka)
+ Fixed labels rendering for parallel edges. Now they are displayed separately for each edge.
+ Fixed async calculations being broken due to LogicCore property became dependency
+ Fixed ViewFinder not deriving ZoomControl content background
+ Fixed edge label update on alignment change
+ Fixed self-looped edges handling in GraphArea::GenerateEdgesForVertex() method
+ Fixed bugs with edge routing calculation in some cases
+ Fixed: Graph-Area LogicCore Property was registered using GraphAreaBase which could cause a problem (thanks to Paul Mandalka)
+ Fixed visual properties recovery terminating template values 
+ Fixed Sugiyama and EfficientSugiyama algorithms calculation with only one vertex
+ Implemented some properties as dependencies
+ Implemented EdgeControl::IsSelfLooped property as read-only dependency property.
+ Reworked EdgeLabelControl inner logic. Should now be more flexible and performance efficient.
+ Reworked main objects hierarchy to use more interfaces for loosened conditions
+ Some code refactoring. Minor performance improvements.


  • kindrashunt likes this

#308 Tutorial on FRENCH language has been released!

Posted by Alexander Smirnov on 05 May 2014 - 06:44 AM

Thanks to Kindrashunt, now we have basic tutorial for GraphX on French language. All interested persons can look at:


  • kindrashunt likes this

#1152 Edges overlap to the center of the vertex

Posted by Alexander Smirnov on 09 June 2016 - 09:23 AM

I've updated the code and added VCPRoot property so you can define VCP host container easily. Please check the latest sources, i've also updated the tmp code in debug page.

  • florinh likes this

#1151 Edges overlap to the center of the vertex

Posted by Alexander Smirnov on 09 June 2016 - 08:43 AM

Oh, i'm sorry! Completely forgot that i've already researched the possibility. You can use the approach from debug page. The point is that you have at least one VCP and you get the visual parent from this VCP for all new VCPs you add at runtime. I'll check how the process can be automated and further simplified .

  • florinh likes this

#1125 Проблема LinLog

Posted by Alexander Smirnov on 03 April 2016 - 11:33 AM

Здравствуйте, спасибо за наводку! Исправил в последнем коммите. Так же добавил свойство ParameterizedLayoutAlgorithmBase::EnsureUniqueRandomInitialPositions. Для LinLog оно True по умолчанию, для остальных False. Если False = все как раньше и работает конечно шустрее, т.к. нет проверок на уникальность генерируемых позиций. Если встретится еще где-нибудь похожая ситуация можно будет подправить включением свойства для конкретного алгоритма.

  • Катя likes this

#1108 Проблема LinLog

Posted by Alexander Smirnov on 08 March 2016 - 11:33 AM

Здравствуйте, постараюсь исправить как будет время, надо будет разобраться в алгоритме. Спасибо, что сообщили о проблеме!

Ps : Кстати, с праздником! :)
  • Катя likes this