Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DrawingControl3D - SelectedEntityChanged RoutedEvent #204

Open
dbalogh78 opened this issue Apr 17, 2023 · 1 comment
Open

DrawingControl3D - SelectedEntityChanged RoutedEvent #204

dbalogh78 opened this issue Apr 17, 2023 · 1 comment

Comments

@dbalogh78
Copy link

I've seen, that the Event SelectedEntityChangedEvent is called inside the setter of the SelectedEntity dp. It will be fired before the value actually gets set. Therefore when subscribing to the Event the SelectedEntity is not set at the moment of handling the event, so I can't interact with the SelectedEntity (getting Properties, etc.). Is this by purpose? I mean the the Event-Name implies, the property has already been changed at this moment, doesn't it?
Sure I can solve this by some workaround, just were curios about the reason for the decision.

@fullflash13
Copy link

fullflash13 commented Jan 4, 2024

Hi,
you want use somting like this ?
` private void DrawingControl_SelectedEntityChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e)
{

  if (DrawingControl.SelectedEntity == null || DrawingControl.Selection == null || DrawingControl.Selection.Count() <= 0) return;
  IPersistEntity persistEntity = DrawingControl.Selection.First();
  if (persistEntity == null) return;
  if (_currentEntity != null)
  {
      if ( _currentEntity.EntityLabel == persistEntity.EntityLabel)
      {
          return;
      }
  }
  SpatialControl.ScrollIntoView(persistEntity);
  SpatialControl.SelectedEntity = persistEntity;
  e.Handled = true;

}`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants