Questions tagged [actualwidth]

ActualWidth is set by the rendering system, and may be different depending on the widths of other elements and overall size constraints. As a result, it can not be changed.

91 questions
51
votes
7 answers

What is the difference between Width and ActualWidth in WPF?

I am currently working with Panels in WPF, and I noticed that as regards the Width and Height properties, there are also two other properties called ActualWidth and ActualHeight. ActualWidth Gets the rendered width of this element. This is a…
Andreas Grech
  • 105,982
  • 98
  • 297
  • 360
47
votes
3 answers

Why are ActualWidth and ActualHeight 0.0 in this case?

I have a Grid inside a Canvas defined like this:
Andre Pena
  • 56,650
  • 48
  • 196
  • 243
25
votes
2 answers

How to bind a read-only WPF control property (eg ActualWidth) so its value is accessible in the view model?

I want to bind a read-only property of a control to my view model so that the value is available in the view model. What is the best way of doing this? For example I'd like to bind ActualWidth to a property in my view model. The width value is…
Ashley Davis
  • 9,896
  • 7
  • 69
  • 87
24
votes
8 answers

Binding to ActualWidth does not work

In a Silverlight 3.0 application I'm attempting to create a rectangle in a canvas and have it stretch the whole width of the canvas. I have attempted to do this by binding to the ActualWidth property of a parent container (seem sample below),…
Richard McGuire
  • 10,780
  • 8
  • 31
  • 34
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
11
votes
1 answer

Get the size (after it has been "stretched") of an item in a ViewBox

Consider the following: Let's say the Window is 1024x768 and the ViewBox fills the entire window, this means the TextBox is really large on the screen. I want to get the size of the TextBox as it is currently on the screen. If I get DesiredSize or…
TimothyP
  • 21,178
  • 26
  • 94
  • 142
9
votes
2 answers

How to Set Grid Column MaxWidth depending on Window or Screen Size in XAML

I have a 3 column grid in a window with a GridSplitter on the first column. I want to set the MaxWidth of the first column to a third of the parent Window or Page Width (or ActualWidth) and I would prefer to do this in XAML if possible. This is some…
Johan Danforth
  • 4,469
  • 6
  • 37
  • 36
9
votes
3 answers

How to force ActualWidth and ActualHeight to update (silverlight)

I a grid on my silverlight control, I am programatically adding a canvas, and in the canvas I am loading and displaying Image. I'm also adding a rotation to the canvas. The problem is that by default the CenterX and CenterY of the rotation is the…
Jeremy
  • 44,950
  • 68
  • 206
  • 332
9
votes
3 answers

how to calculate the textbock height and width in on load if i create textblock from code?

TextBlock tbl= new TextBlock(); tbl.text="Kishore"; double x=tbl.ActualHeight; double y=tbl.ActualWidth; If i execute the code from the loaded event in Metro - winRT will return 0 for both. How can I get the ActualWidth in the Loaded or…
Kishore Kumar
  • 21,449
  • 13
  • 81
  • 113
7
votes
4 answers

WPF ActualWidth is zero

I have a user control which has a Canvas of height 100 and width 1920. At the loading of the control, I go to an external source, download a text file and add TextBlocks to the Canvas. Then I want to create a marquee scrolling effect which should…
Mark
  • 14,820
  • 17
  • 99
  • 159
6
votes
2 answers

Why ActualWidth and ActualHeight start from 0,0?

I want to add WPF Path to InkCanvas and use selection to select WPF Path. So, I use this code. System.Windows.Shapes.Path path = drawCanvas.Children[i] as System.Windows.Shapes.Path; …
Hong Lim
  • 133
  • 1
  • 4
  • 12
5
votes
1 answer

Is it possible for a WPF control to have an ActualWidth and ActualHeight if it has never been rendered?

I need a Viewport3D for the sole purpose of doing geometric calculations using Petzold.Media3D.ViewportInfo. I would prefer not to have to place it in a Window or otherwise render it. I'm attempting to accomplish this by instantiating a Viewport3D…
devuxer
  • 41,681
  • 47
  • 180
  • 292
5
votes
1 answer

WPF Canvas.ActualWidth zero, even after loading

I cannot get ActualWidth of a canvas to any nonzero value. I simplified the real scenario and devoted a new WPF Application in VS to getting a nonzero value (and understanding). Unfortunately, I'm only getting zero. I feel like I'm missing some…
JBSnorro
  • 6,048
  • 3
  • 41
  • 62
4
votes
1 answer

ActualWidth as value of From WPF animation

Why can't I refer to ActualWidth as a value from, which I was able to use in code. XAML:
4
votes
1 answer

Sizing WPF controls to an exact percentage

In WPF, I want set a controls width to be, say, 97% of it's Parent controls ActualWidth property. How can I do this?
will
  • 3,975
  • 6
  • 33
  • 48
1
2 3 4 5 6 7