event handling - WPF: Get underlying element inside adorner in PreviewMouseLeftButtonDown of a Canvas -


Element with Edner in the canvas uses Edgar's visual evaluation, and places a thumb in a specific place of the decorated element. is. I would like to click on the adonant, preview the canvas preview mouse-left buttondown element and get the underlying element inside the adornor. But in this case I get main window as ESOs. Could you please help? I'm a newbie in WPF.

  Public class connector Edward: Adornor {private readonly connector thumb _thumb; Private Readonly Visual Collection _ Visual; Public Connector Edner (UIElement Beautified Element): Base (Decorated Element) {Focusable = True; _ Visual = new visual evaluation (this); _thumb = new connector thumb (); _thumb.Background = Brush Transpain; _visuals.Add (_thumb); } Secure Override Size Arrange Override (Size Final Size) {Double elHeight = AdornedElement.DesiredSize.Height; Double Edender Width = desired size. Wide; Double ederHeight = desired size. Light; _thumb.Arrange (New Rectangle (0, -Highight / 2, Brilliant Width, AdornerHeight)); Return final size; } Protected Override Visual Genetical Choled (Int Index) {Returns _Visals [Index]; } Protected override int visual billrink count {get {return_visuals.Count; }}} Size of public squares: UserControl {Private AdornerLayer _adornerLayer; Public size () {width = 50; Height = 50; Background = brush Tomato; Sector Area = New Thickness (2); Borderbrush = brush Black; this. Loaded + = overloaded; } Private Zero Onloaded (Object Sender, Routing Avenues Areas Attentor) {_adornerLayer = AdornerLayer.GetAdornerLayer (this); If (_adornerLayer! = Faucet) {Connector Edwardner = New Connector Edenner (this); _adornerLayer.Add (adorner); }}} Public square connector thumb: thumb {public connector thumb (width) = {width = 20; Height = 20; Background = brush. Transparent; Foreground = brush Black; Border zone = new thickness (1); IsHitTestVisible = True; }} Public Partial Class Main Window: Window {Private Zero OpenViewUp Life Button (Object Sender, Mousebutton and Evergus E) {// I want to get Connect here ..}}    < P>  Canvas.ZIndex  property on the elements. This will ensure that the elements are layered in the way you want.   

Comments

Popular posts from this blog

Java - Error: no suitable method found for add(int, java.lang.String) -

java - JPA TypedQuery: Parameter value element did not match expected type -

c++ - static template member variable has internal linkage but is not defined -