0

Object's width and height are binded to variables in modelview, so I can easly know size of the object. Unfortunetly they get NotANumber instead of actual value. I don't want to use standard object.Width and object.Height parameteres from code-behind, since it'd be complicated to access them from modelview. I've read something about ActualWidth and ActualHeight properties, but they are not available in my Visual Studio 2010. What should I do?

XAML:

<ListView Width="{Binding wdth, Mode=OneWayToSource}"
          Height="{Binding hght, Mode=OneWayToSource}" />

Code-behind:

public class modelview
{
    public double wdth {get;set;}
    public double hght {get;set;}
}
Rohit Vats
  • 79,502
  • 12
  • 161
  • 185
Rico
  • 362
  • 1
  • 4
  • 18
  • 2
    Probably this answer can help http://stackoverflow.com/questions/1083224/pushing-read-only-gui-properties-back-into-viewmodel – Somedust Dec 05 '13 at 08:11

1 Answers1

0

you probably need to get the ActualWidth and ActualHeight
they are not availble throw binding attatched property is way, see the answer links in :
How to bind a read-only WPF control property (eg ActualWidth) so its value is accessible in the view model?

Community
  • 1
  • 1
ZSH
  • 905
  • 5
  • 15