Click here to Skip to main content
15,896,606 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello everyone,
I need to get the dynamical Height and Width of my Viewbox
The hierarchy of my xaml is like this:
XML
<Grid>
 <DockPanel>
  <Border>
   <ViewBox/>
  </border>
 </DockPanel>
</Grid>


The Viewbox Width is on "Auto" and the Height is binded to a variable in my Controller.
The Class hierarchy is like this:
Xaml <--> Controller
(the xaml.cs is mostly ignored)

Now my problem is that even in the direct code-behind (xaml.cs), I get 0 as ActualWidth and ActualHeight. So I don't even get the standart Width and Height not to mention the dynamical one if I change the dimension of my mainwindow.

If Code-Snippets or information are missing. Please tell me.

Regards
Richard

What I have tried:

I tried to get the Dimensions with in the Code-Behind:
Height/Width (Only get the standard Height and NaN for Width)
ActualHeight/ActualWidth (both are 0)
RenderSize.Height/RenderSize.Width (both are 0)
Posted
Updated 14-Jun-16 21:05pm

1 solution

The solution was simply. I didn't render the image before i get the Width and Height.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900