سؤال

I have an image editing application, and I have custom adorners which get added to an AdornerLayer. When the user clicks on an Adorner, I want to bring it to top - meaning if it is dragged over another adorner, I want the first click to be caught by the topmost adorner.

I can't figure out how to change the z-order of the child elements of the AdornerLayer. It doesn't seem to allow me to sort them. Even if I remove and re-add the Adorner, it doesn't get topmost.

هل كانت مفيدة؟

نصائح أخرى

I had a similar problem, but just needed a specific ordering of my adorners. I ended up using reflection to set the orders:

var setZOrderMethodInfo = adornerLayer.GetType().GetMethod("SetAdornerZOrder", System.Reflection.BindingFlags.NonPublic |  System.Reflection.BindingFlags.Instance);     
setZOrderMethodInfo.Invoke(adornerLayer, new object[] { adorner1, 0 });     
setZOrderMethodInfo.Invoke(adornerLayer, new object[] { adorner2, 1 });

from http://social.msdn.microsoft.com/Forums/en/wpf/thread/40bff84e-c4b5-4ea0-87ea-43461df9f24b

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top