When I press a button to add a shape to my canvas I need it to be placed inside my current viewing area on the canvas. Currently, I have it hard-coded. Do you have some example code to do this? I pass the position using my "GroupDD" object.
Thanks in advance for your help,
Joel
Thanks in advance for your help,
Joel
private
void
btnAddGroup_Click(
object
sender,
RoutedEventArgs e)
{
try
{
((AppSettings)DataContext).Model.AddGroup(
new
GroupDD()
{
Name =
"New Group"
,
DynamicProperties =
new
NameValuePairList()
{
new
NameValuePair()
{
Name =
"PositionLabel"
,
Value = GroupNode.GetPointLabel(
new
Point(20, 20))
}
}
});
public
void
AddGroup(
GroupDD group)
{
GroupNode node = GetGroupNode(group);
GraphSource.AddNode(node);
}
public
GroupNode GetGroupNode(
GroupDD group)
{
GroupNode node =
new
GroupNode()
{
Position = GetPoint(group.DynamicProperties),
Group = group
};
return
node;
}
public
class
GroupNode : NodeViewModelBase, INotifyPropertyChanged
{
...
}