-
Notifications
You must be signed in to change notification settings - Fork 5
VirtualCanvas Module
Mark Kromis edited this page Oct 20, 2019
·
4 revisions
This handles objects that get created when in view and destroyed when leaving view.
- WPF (Framework)
- IMesAutoScroll -- Platform scrolling support.
- IMesContentCanvas -- Platform canvas control.
- IMesMapZoom -- Platform zooming control.
- IMesPan -- Platform panning control.
- IMesRectangleSelectionGesture -- Platform rectangle UI drawing.
- IMesVirtualCanvas -- The main interface that controls the CanvasControl. This can be used in netstandard space.
- IMesVirtualCanvasControl -- Interface to the UI control, use platform namespace for control (ie. Graph)
- IMesVirtualChild -- Platform interface to child to create necessary visuals
This happens in 2 basic parts
Create a view model that inherits from IMesVirtualCanvas
. This should handle all necessary adding items to the Graph.VirtualChildren. If using the split method, the IVirtualChild may need to created in platform module and injected into the core classes.
The demo also inherits from MesDocument : IMesVirtualCanvas as a single control document.
The second part handles the UI control. For this example we are using a WPF object. Add a reference to the namespace and embed the object.
<mvx:MvxWpfView
...
xmlns:ui="clr-namespace:MinoriEditorShell.VirtualCanvas.Platforms.Wpf.Controls;assembly=MinoriEditorShell.VirtualCanvas"
xmlns:mvx="clr-namespace:MvvmCross.Platforms.Wpf.Views;assembly=MvvmCross.Platforms.Wpf"
...>
<ScrollViewer
HorizontalScrollBarVisibility="Auto"
VerticalScrollBarVisibility="Auto"
CanContentScroll="True">
<ui:MesVirtualCanvas x:Name="Graph" />
</ScrollViewer>
</mvx:MvxWpfView>
Then add the code behind.
DataContextChanged += (s, e) =>
{
IMesVirtualCanvas dc = (IMesVirtualCanvas)DataContext;
Graph.UseDefaultControls(dc);
};
- Chris Lovett -- Original inspiration A Simple Virtual Canvas.doc