WPF Positioning deals with placement of elements within a WPF application.
Questions tagged [wpf-positioning]
37 questions
101
votes
6 answers
Get Absolute Position of element within the window in wpf
I would like to get the absolute position of an element in relation to the window/root element when it is double clicked. The element's relative position within it's parent is all I can seem to get to, and what I'm trying to get to is the point…

BrandonS
- 2,513
- 7
- 28
- 29
53
votes
6 answers
Changing the start up location of a WPF window
I'd like to have a WPF window open in the top right part of the screen.
Right now I can achieve that by opening the window and then moving it (via movewindow in user32.dll). However, this approach means the window opens in it's default location,…

Evan
- 4,450
- 10
- 40
- 58
30
votes
4 answers
How to center an element in wpf canvas
How can I center an element in wpf canvas using attached properties?

Soham Dasgupta
- 5,061
- 24
- 79
- 125
15
votes
1 answer
How to obtain the ActualWidth of a WPF Popup
I am trying to place a Popup element in a specific position, relative to the Placement control.
In order to achieve that I need to find out the ActualWidth of the popup control.
But trying to get this value before or after displaying the popup…

Nikos Tsokos
- 3,226
- 2
- 34
- 41
8
votes
1 answer
Positioning UIElement on a Canvas
I have a canvas and a red rectangle laid on it.
Rectangle has a MouseDown event handler implemented:
private void RedRectangle_MouseDown(object sender, MouseButtonEventArgs e)
{
CreateMyBorder();
}
The CreateMyBorder method is supposed to…

Boris
- 9,986
- 34
- 110
- 147
7
votes
4 answers
Wpf - centering on primary desktop
I know WPF has a "CenterScreen" value for centering a window on the desktop.
However, on dual monitor, that is not very pleasant.
How do I center on primary monitor? Do i need to go through the song and dance of detecting the primary desktop, get…

Will I Am
- 2,614
- 3
- 35
- 61
6
votes
1 answer
Positioning adorner relative to parent's dimensions in WPF
I am trying to position an Adorner depending on the dimensions of the parent of the adorned element. For example, I have a textbox. I want to adorn this textbox so it looks something like this:
how the adorner needs to be placed…

Nilu
- 245
- 1
- 4
- 17
4
votes
1 answer
Getting wpf gridid
If in my wpf application there are multiple grids and a dragable user control.Can anyone suggest code that could return different grid id every time the control is dragged over different grids.

Aksel
- 53
- 3
4
votes
2 answers
Creating WPF popup
I want to create a modal popup. So far I have made a window which I create when I need it. But I don't think that is the right way to do this. The problem is, everytime I call it, it opens about 20px to the right and 20px lower than previous one.…
user360330
4
votes
1 answer
How to make tooltip appear at fixed position (in this case: bottom left corner of page)
I have several items (in the form of rectangles) inside a "Carousel" (which again is basically just a fancy PathListBox)
When the mouse hovers over one of those rectangles, a tooltip with some information appears. The look of the rectangles is…

steady_progress
- 3,311
- 10
- 31
- 62
4
votes
2 answers
Dynamically changing the start up location of a WPF window
This is a follow up question to an answered question [here][1].
There the startup position of a WPF window was defined in XAML. Now I'm wondering how to change those properties in code? For example could I say something like:
Window1.Top = 40 in…

Evan
- 4,450
- 10
- 40
- 58
3
votes
1 answer
How do I position an element within a WPF Grid column?
Let's say I want to position an element at the coordinates x=20, y=5 within the 3rd column of a Grid control. How do I do this? Do I need to add a Canvas panel to the column and then add the controls to it?

Trap
- 12,050
- 15
- 55
- 67
2
votes
1 answer
Making the TreeView.ItemsPanel a Canvas
I am looking for a way to make my TreeView display items in Canvas panel.
…

Aaron Summernite
- 355
- 1
- 5
- 15
2
votes
1 answer
How should mouse position dependent actions occur under the MVVM model?
I have an application which has a drawing surface, where actions the user takes correlate strongly to the position of the mouse cursor. For the sake of example, let's say I'm trying to implement paste. In this case, the pasted data should be placed…

Billy ONeal
- 104,103
- 58
- 317
- 552
2
votes
2 answers
Bind a value to a control's absolute position in XAML
Is there a way to bind a value to the absolute position of a control using XAML?
I have a Line element that I would like to be drawn between two Buttons in my application. I was thinking that binding the starting point of the Line to the position of…

sourcenouveau
- 29,356
- 35
- 146
- 243