We have two situations: one in which a ManipulationAdorner shows up, and one in which it does not. I've determined that the sole difference, as far as I can tell, is the Visibility property on ManipulationAdorner itself. In the one case, the Visibility is "Visible"; in the other, "Collapsed".
I see no other differences in this situation, including with DataContext and the styles/templates. That is, in both cases, the DataContext has the same property values, and, in both cases, the styles/templates used are the same.
Visibility is being set locally, which means directly on the object either in xaml or in code. We don't set Visibility directly ourselves, so I'm wondering whether there is logic internal to Diagram or ManipulationAdorner that sets the Visibility? If so, what are the conditions that result in Visible vs Collapsed, please? My hope is that I can work backwards from there to figure out how we're triggering the Collapsed state.
Thank you!
-David Marshburn
The actual ManipulatorAdorner object has visibility set to Visibile/Collapsed.
If it helps, I attach two images of what Visual Studio's visual tree and property explorer have to say. Note that Visibility is being set locally. Also, Snoop confirms that the Visibility is set locally.
I've verified that, in both cases, that the selected Diagram objects are selected; that is, instances of subclasses of NodeViewModelBase have IsSelected set to true. My understand is that that's what should trigger the ManipulatorAdorner to be visible.
Unfortunately, sharable code is going to be tough -- this exists in a large business project I can't share. I acknowledge that makes this request difficult. I guess I'm asking for any advice without sharable code and without me taking a day+ to develop a stand-alone project.
What I'm hoping that can happen, though, is that someone can take a look at the ManipulatorAdorner code (or maybe Diagram code) and tell me what sort of situations result in the ManipulatorAdorner's Visibility being set to Collapsed. Since it's set locally, there has to be a line of code somewhere doing that.
Further, as an aside, you'll see the name MKBManipulableRadDiagram in the visual tree; that's a subclass of RadDiagram we wrote to add some specific mouse & keyboard handling, but that's all it does (and the handling is the same for both of these situations).
Also, I meant to say that I'm on v. 2021.1.325.40 (which is a couple of years old, admittedly).
Thanks!
Thank you for the extra information.
I am afraid that I can't tell what is happening without the project, but I can give you some insight on when the ManipulationAdorner is displayed. This is the code that sets the visibility:
public void Update(IEnumerable<object> items, bool show) { IConnection connection = items.FirstOrDefault() as IConnection; var isSingleSelectedConnection = items.Count() == 1 && connection != null; var isConnectionAdornerActive = isSingleSelectedConnection && connection.IsConnectorsManipulationEnabled && connection.IsEnabled; var newVisibility = show ? Visibility.Visible : Visibility.Collapsed; if (isConnectionAdornerActive) { newVisibility = System.Windows.Visibility.Collapsed; } this.Visibility = newVisibility; }
var isManipulationAdornerVisible = this.SelectionService.SelectedItems.All(d => d.IsManipulationAdornerVisible);
var manipulating = adornerBounds != new Rect() && isManipulationAdornerVisible && !adornerBounds.X.IsNanOrInfinity() && !adornerBounds.Y.IsNanOrInfinity() && !adornerBounds.Width.IsNanOrInfinity() && !adornerBounds.Height.IsNanOrInfinity(); this.manipulationAdorner.Update(this.SelectionService.SelectedItems, manipulating);
And this code is called on several occasions, like zoom, resize, rotate, selection and more.
If this isn't enough, you can download the source code of Telerik UI for WPF from your telerik.com account and see more details on the updates.
And if this doesn't help, I suggest you to try isolating this in a runnable project or open a new private ticket and share your original project if possible.