Closed khalili-mahdi closed 6 years ago
I don't understand your question!
there is yellow borders when ever you move controls inside designer , show up in middle of designer and borders of designer which controls border stick to it , i think they are splitters if i'm wrong let me know you can add them to designer by clicking on borders i think , i want to create them dynamically instead of using gridSplitter because they hold controls inside and dont let control to move out
This are Adorners wich are shown for each Grid Column or Row.
Means If yo add a new Column to grid.columndefinitions you will see it
var desItem= MyDesignerModel.Instance.DesignSurface.DesignContext.RootItem;
desItem.Services.Selection.PrimarySelection.Properties.GetProperty("ColumnDefinitions").CollectionElements.Add(desItem.Services.Component.RegisterComponentForDesigner(new ColumnDefinition(){Width = new GridLength(200)}));
desItem.Services.Selection.PrimarySelection.ReapplyAllExtensions();
Ty for your Great Work
i did this
var desItem = designSurface.DesignContext.RootItem;
for (int i = 0; i < 5; i++)
{
desItem.Properties.GetProperty("ColumnDefinitions").CollectionElements.Add(desItem.Services.Component.RegisterComponentForDesigner(new ColumnDefinition() { Width = new GridLength(200) }));
}
desItem.ReapplyAllExtensions();
its giving me error in DesignItem.cs in AddBehavior 'An item with the same key has already been added.'
are you using newest source code? I think I did a fix cause of this error a few days ago
yeah i have latest source
public void AddBehavior(Type behaviorInterface, object behaviorImplementation)
{
if (behaviorInterface == null)
throw new ArgumentNullException("behaviorInterface");
if (behaviorImplementation == null)
throw new ArgumentNullException("behaviorImplementation");
if (!behaviorInterface.IsInstanceOfType(behaviorImplementation))
throw new ArgumentException("behaviorImplementation must implement bevahiorInterface", "behaviorImplementation");
_behaviorObjects.Add(behaviorInterface, behaviorImplementation);
}
it stucks at last line of this function
Could not reproduce
it works on my sample
in DesignSurface there is one horizontal and vertical splitter in middle of page , which controls sticking to them i want 4 of those guys,which can be resized here is my wrong code :)