Objective: User selects objects, when a user clicks ‘set same width button’, the diagram would take the last selected object and apply that width to the other objects.
Question 1: Does diagram.SelectedPart represent the last selected object? If so, using CTRL + selection does not update this property.
Question 2: What is the right way to update width property of controls? This does not seem to work properly. I checked and it's set to NaN in the debugger prior to me setting the width.
foreach (var node in diagram.SelectedParts.OfType<Node>()){node.Width = width;
Thank you,
Pavel
public void SameWidth()
{
Diagram diagram = this.Diagram;
diagram.StartTransaction(TranscationName.SameWidth);
Diagram diagram = this.Diagram;
diagram.StartTransaction(TranscationName.SameWidth);
try
{
var width = diagram.SelectedPart.ActualWidth;
foreach (var node in diagram.SelectedParts.OfType<Node>())
var width = diagram.SelectedPart.ActualWidth;
{
node.Width = width;
}
diagram.CommitTransaction(TranscationName.SameWidth);
node.Width = width;
}
}
catch (Exception){
diagram.RollbackTransaction();
}
}
catch (Exception){
diagram.RollbackTransaction();
}