MapView is a silverlight user interface control that displays hierachy as mind map.
DLL: comapping.silverlight.controls.mapview.dll
Namespace: comapping.silverlight.controls.mapview
Depends on several DLL's:
- haxe.dll
- comapping.silverlight.controls.common.dll
MapView is singleton
At the moment MapView is singleton. So there can be only one instance of MapView. This instance is MapView.instance
UIDispatcher
MapView uses UIDispatcher for invoking code in UI thread. So it is needed to initialize UIDispathcer like below
UIDispatcher.instance = Application.Current.RootVisual.Dispatcher;
Data source
MapView visualize data provided by its data source. MapView's data source has to be subclass of MapViewDataSource. It is required to overload function setMapView. MapView gets MapModel from data source. The better place to put MapModel to MapView is setMapView. It may look like below.
public override void setMapView(MapView mapView) { this.mapView = mapView; if (null != model) { mapView.controller.model = model; } }
A topic is an hierarchy element
MapView displays data from MapModel. Elementary element of data is Topic. By default Topic controls only its position in hierarchy. So to control and display any content it needs new class derived from Topic. Minimally new class should overload:
MapModel creating
Topic root = new Topic(null); Topic firstChild = new Topic(root); Topic secondChild = new Topic(null); root.insertChild(secondChild); model = new MapModel(root); model.readOnly = true;
Topic's content
Topic's content should be a FrameworkElement. For example, like below.
<UserControl xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:comapping_silverlight_controls_mapview_view="clr-namespace:comapping.silverlight.controls.mapview.view;assembly=comapping.silverlight.controls.mapview" mc:Ignorable="d" x:Class="comapping.silverlight.xmlViewer.XmlContentView" d:DesignWidth="640" d:DesignHeight="480"> <Grid x:Name="LayoutRoot"> <comapping_silverlight_controls_mapview_view:TopicTextView x:Name="textView" /> </Grid> </UserControl>
Connect MapView and data source
MapView.instance.dataSource = ds;
Sample
On our site there is an example of MapView's using. It is xmlViewer