adorner

WPF TextBox with ellipsis trimming and validation adorner

被刻印的时光 ゝ 提交于 2019-12-12 04:39:54
问题 I am currently working on an user control to add some more functionality to a TextBox: Ellipsis trimming if the text is to large and the TextBox has lost the focus Label in front of the TextBox Validation on error I found an example for ellipsis. This example stores the current value of the TextBox in a dependency property and sets the TextBox.Text property if the element got/lost the focus. Here my xaml-code of my user control: <UserControl x:Class="WpfTextBoxEllipsis.EditUC" xmlns="http:/

WPF get visual from mouse position

点点圈 提交于 2019-12-11 18:31:41
问题 I have a canvas where a draw some GraphNodes and add them to the canvas as ContentControls. All graph nodes have an adorner which I use to draw connection lines from a node to another node. The adorner has a method OnMouseUp: protected override void OnMouseUp(System.Windows.Input.MouseButtonEventArgs e) { var SourceNode = AdornedElement; Point pt = PointToScreen(Mouse.GetPosition(this)); var DestinationNode = ??? } At this point I have the source node from where I started to draw the line in

Include Adorner in ScrollViewer scrollable region

笑着哭i 提交于 2019-12-10 17:48:15
问题 I currently have an Adorner inside a ScrollViewer . Objects at the bottom of the scrollviewer can sometimes display a large adorner below them. Unfortunately, that adorner is not included in the ExtentHeight of the scrollviewer, so the lower portion of the adorner is clipped by the bottom of the scrollviewer's viewport. Is there a way to get the adorner layer's contents to be included in the scrollable region of the scrollviewer? 回答1: I'm afraid the consensus from other sources and hours of

No events passed to WPF adorner layer

断了今生、忘了曾经 提交于 2019-12-10 13:50:02
问题 I am trying to make a nice "drag and drop zone" in WPF that is displayed in the adorner layer when something is being dragged into the main application. The problem is that I do not get any events from my adorner, even though it according to documentation should receive all input events since it is in a higher z-order. To debug my problem I created a really simple example where I have a user control with only a button in it. This user control is displayed in the adorner layer, but I cannot

What's the point to WPF adorners?

家住魔仙堡 提交于 2019-12-10 09:23:32
问题 I've recently developed a drawing component for my company, featuring a Canvas on which you can draw certain shapes using click-and-drag. For each shape, I placed two adorners on its AdornerLayer: One for increased hit detection (basically a transparent rectangle that would exceed the shape's boundaries by a few pixels), and another for resizing (four Thumb controls on the corners). But, I ran into many problems when implementing some of the features of the component, all adorner related.

WPF Adorner Clipping

﹥>﹥吖頭↗ 提交于 2019-12-09 16:30:53
问题 I have an ItemsControl in a ScrollViewer . The items in the ItemsControl are expanded to a DataTemplate which basically consists of an Adorner . Now the problem is, when scrolling, the Visual Children of the Adorner are visible outside the ScrollViewer . Lets say I scroll from the Horizontal Offset 0 to 100, the Visual Children of the Adorner move to the left and are visible next to the ScrollViewer , although they should be hidden. Setting ClipToBounds on the ItemsControl or the ScrollViewer

WPF: Ignore mouse clicks on overlay/adorner, but handle MouseEnter event

拟墨画扇 提交于 2019-12-09 07:51:45
问题 What I really want is a version of IsHitTestVisible that ignores mouse click events but still traps mouse enter and leave events. Background: An informational overlay pops up under the control with focus whenever. This is a requirement, so I'm not at liberty to remove this behavior. This is implemented using an adorner containing a Rectangle shape, filled with an image brush. All controls are created programatically, no XAML involved. Desired behavior: When user mouses over the Rectangle, it

WPF Validation Control Template overlapping

倖福魔咒の 提交于 2019-12-09 00:39:17
问题 I've got a user control with a control template to show validation errors, validation template: <ControlTemplate x:Key="TextBoxPropertyValidationTemplate"> <StackPanel> <Border BorderBrush="Red" BorderThickness="1"> <AdornedElementPlaceholder x:Name="MyAdorner" /> </Border> <Grid> <Grid.ColumnDefinitions> <ColumnDefinition Width="Auto" /> <ColumnDefinition Width="*" /> </Grid.ColumnDefinitions> <Image Grid.Column="0" MaxHeight="16" MaxWidth="16" Source="{Binding Source={StaticResource

Adorner and Events on Adorned element

天大地大妈咪最大 提交于 2019-12-07 05:32:12
问题 I have a custom Line Shape that use an adorner to display an array and some text in the middle of that line. The problem is that the adorned behaves independently of the adorned element, and does not "transfer" the event to it. In the following code I am forced to manually relink the adorner elements to adorned element ( ta.MouseLeftButtonDown += Adorner_MouseLeftButtonDown; ), but unfortunately even this does not work... Could somebody advice what is wrong when calling this

Why AdornerLayers are always the top most layers? Is there a way to change it?

喜欢而已 提交于 2019-12-06 07:28:18
问题 Why is that the adorner layer is always rendered as the top most layer in an application (under AdornerDecorator - refer screenshot)? Is there a way to change the layer/level on to which the adorners can be drawn? In the following screenshot, AdornerLayer is added to AdornerDecorator and the Adorners (MyAdorners) are added to this AdornerLayer. But the AdornerLayer is retrieved like this, AdornerLayer layer1 = AdornerLayer.GetAdornerLayer(button1); layer1.Add(new MyAdorner(button1)); 回答1: To