You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello,
In the DrawingControl3D, there is a DependencyProperty Selection which is an EntitySelection, as I understand, a collection of Entities :
public EntitySelection Selection
{
get { return (EntitySelection)GetValue(SelectionProperty); }
set { SetValue(SelectionProperty, value); }
}
public static readonly DependencyProperty SelectionProperty = DependencyProperty.Register("Selection",
typeof(EntitySelection), typeof(DrawingControl3D), new PropertyMetadata(OnSelectionChanged));
private static void OnSelectionChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
var d3D = d as DrawingControl3D;
if (d3D == null)
return;
var newVal = e.NewValue as EntitySelection;
d3D.ReplaceSelection(newVal);
}
This Selection is usefull in multiselection cases, to bind the collection of selected entities between the treeview part of the explorer, and the DrawingControl3D for example.
When the Selection is set, the event OnSelectionChanged is raised, but we never subscribe to the OnCollectionChanged event of the Selection, which means that if an Entity is added or removed to the Selection, no event will be raised and the binding fails.
Same in the OnSelectedEntityChanged event, the Selection is Cleared but it doesn't raised any event and so the selected Entities stay selected in the DrawingControl3D.
I would do something like this :
var newVal = e.NewValue as EntitySelection;
var oldVal = e.OldValue as EntitySelection;
if (newVal != null)
{
newVal.CollectionChanged += d3D.OnSelectionCollectionChanged;
}
if (oldVal != null)
{
oldVal.CollectionChanged -= d3D.OnSelectionCollectionChanged;
}
and update the Highlight in the OnSelectionCollectionChanged.
What do you think ?
The text was updated successfully, but these errors were encountered:
Hello,
In the DrawingControl3D, there is a DependencyProperty Selection which is an EntitySelection, as I understand, a collection of Entities :
This Selection is usefull in multiselection cases, to bind the collection of selected entities between the treeview part of the explorer, and the DrawingControl3D for example.
When the Selection is set, the event OnSelectionChanged is raised, but we never subscribe to the OnCollectionChanged event of the Selection, which means that if an Entity is added or removed to the Selection, no event will be raised and the binding fails.
Same in the OnSelectedEntityChanged event, the Selection is Cleared but it doesn't raised any event and so the selected Entities stay selected in the DrawingControl3D.
I would do something like this :
and update the Highlight in the OnSelectionCollectionChanged.
What do you think ?
The text was updated successfully, but these errors were encountered: