Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/kevinbrunet/SkiaSharp.DiagramEngine

Using SkiaSharp with Xaml,Bindings and DataTemplates. Compatible with Xamarin Forms
https://github.com/kevinbrunet/SkiaSharp.DiagramEngine

diagram net-standard-2 skiasharp xamarin xamarin-forms

Last synced: 29 days ago
JSON representation

Using SkiaSharp with Xaml,Bindings and DataTemplates. Compatible with Xamarin Forms

Awesome Lists containing this project

README

        

# SkiaSharp.DiagramEngine
Using SkiaSharp with Xaml,Bindings and DataTemplates. Compatible with Xamarin Forms

## Using SkiaSharp.DiagramEngine
Install the [NuGet package SynodeTechnologies.SkiaSharp.DiagramEngine](https://www.nuget.org/packages/SynodeTechnologies.SkiaSharp.DiagramEngine):
```
nuget install SynodeTechnologies.SkiaSharp.DiagramEngine
```

## Getting Started
```xaml




```

![Image of GetStarted](https://raw.githubusercontent.com/kevinbrunet/SkiaSharp.DiagramEngine/master/Docs/Images/GetStarted.png)

## Layouts
```xaml





















```

![Image of Layout](https://raw.githubusercontent.com/kevinbrunet/SkiaSharp.DiagramEngine/master/Docs/Images/Layout.PNG)

## TemplatedItems
```xaml





























```

```csharp
[XamlCompilation(XamlCompilationOptions.Compile)]
public partial class TemplateItems : ContentPage
{
public class Item : INotifyPropertyChanged
{
public event PropertyChangedEventHandler PropertyChanged;

private string name;
public string Name
{
get
{
return name;
}
set
{
name = value;
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(Name)));
}
}
}

private ObservableCollection items = new ObservableCollection();
public ObservableCollection Items
{
get
{
return items;
}

}

public ICommand AddItemCommand { get; }

public TemplateItems()
{
InitializeComponent ();
this.AddItemCommand = new Command(() =>
{
Items.Add(new Item() { Name = "Item" + Items.Count });
});
this.BindingContext = this;
}
}
```

![Image of TemplatedItems](https://raw.githubusercontent.com/kevinbrunet/SkiaSharp.DiagramEngine/master/Docs/Images/ItemsTemplate.PNG)

## ZoomCanvas
```xaml






























```

![Image of ZoomCanvas](https://raw.githubusercontent.com/kevinbrunet/SkiaSharp.DiagramEngine/master/Docs/Images/Zoom.PNG)

## HierarchicalItemsTemplate
```xaml



























```

```csharp
public partial class HierarchicalItemsTemplate : ContentPage
{
public class HierarchicalItem : INotifyPropertyChanged
{
public event PropertyChangedEventHandler PropertyChanged;

public HierarchicalItem(string name)
{
this.name = name;
}

private string name;
public string Name
{
get
{
return name;
}
set
{
name = value;
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(Name)));
}
}

private ObservableCollection children = new ObservableCollection();

public ObservableCollection Children

{
get
{
return children;
}
}
}

private HierarchicalItem root;
public HierarchicalItem Root
{
get
{
return root;
}

}

public HierarchicalItemsTemplate()
{
InitializeComponent ();
root = new HierarchicalItem("Root");
root.Children.Add(new HierarchicalItem("1"));
root.Children[0].Children.Add(new HierarchicalItem("1.1"));
root.Children[0].Children.Add(new HierarchicalItem("1.2"));
root.Children[0].Children.Add(new HierarchicalItem("1.3"));
root.Children.Add(new HierarchicalItem("2"));
root.Children[1].Children.Add(new HierarchicalItem("2.1"));
root.Children[1].Children.Add(new HierarchicalItem("2.2"));
root.Children[1].Children.Add(new HierarchicalItem("2.3"));
root.Children.Add(new HierarchicalItem("Lorem ipsum dolor sit amet, consectetur adipiscing elit.\nSed non risus. Suspendisse lectus tortor, dignissim sit amet, adipiscing nec, ultricies sed, dolor."));
root.Children[2].Children.Add(new HierarchicalItem("3.1"));
root.Children[2].Children.Add(new HierarchicalItem("3.2"));
root.Children[2].Children.Add(new HierarchicalItem("3.3"));
root.Children[2].Children[0].Children.Add(new HierarchicalItem("Lorem ipsum dolor sit amet"));
this.BindingContext = this;
}
}
```

![Image of ZoomCanvas](https://raw.githubusercontent.com/kevinbrunet/SkiaSharp.DiagramEngine/master/Docs/Images/HierarchicalItemsTemplate.PNG)