Hi Jake,
I have implemented the following MainPage class to create nodes & link.
Now I want to set Image icon for each node directly in this class, not be defining any xaml template.
Can I do this by using some property of GraphLinksModelNodeData?
Please reply me as soon as possible.
public partial class MainPage : UserControl
{
public MainPage()
{
InitializeComponent();
var model = new GraphLinksModel<MyNodeData, String, String, MyLinkData>();
model.Modifiable =
true;
model.HasUndoManager =
true;
model.NodesSource =
new ObservableCollection<MyNodeData>()
{
new MyNodeData() { Key="First", Color="Black", Location = new Point(400.0, 100.0)},
new MyNodeData() { Key="Second", Color="Black", Location = new Point(700.0, 100.0)}
};
model.LinksSource =
new ObservableCollection<MyLinkData>()
{
new MyLinkData() { From="First", To="Second" }
};
myDiagram.Model = model;
}
}
public class MyNodeData : GraphLinksModelNodeData<String>
{
public String Color
{
get { return _Color; }
set {
if (_Color != value) {
String old = _Color;
_Color =
value;
RaisePropertyChanged(
"Color", old, value);
}
}
}
private String _Color = "White";
}
public class MyLinkData : GraphLinksModelLinkData<String, String>
{
// nothing to add
}
public class TextImageSourceConverter : Converter
{
public override object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
return new BitmapImage(new Uri("http://www.goxam.com/go/beatpaths/" +
(value ??
"NE").ToString() + "_logo-50x50.png"));
}
}