Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic ZoomFactor binding is not working (Read 2215 times)
rajesh_patil74
Full Member
***
Offline


I love YaBB 1G - SP1!

Posts: 220
Joined: Sep 3rd, 2009
ZoomFactor binding is not working
Jan 27th, 2011 at 1:10pm
Print Post  
Hi Stoyo

I seen that zoomfactor is dependency property. But I am not able to do binding for same in xaml file.

At run time , i get exception
"ZoomFactor must be positive number" ... even my model file property (which is used for binding) has value set to 100.

-Rajesh
  
Back to top
WWW  
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: ZoomFactor binding is not working
Reply #1 - Jan 27th, 2011 at 3:15pm
Print Post  
Hi Rajesh,

The throw code looks like this, so the exception will only happen if your bound value is 0 or a negative number at some point -

if ((double)e.NewValue <= 0)
     throw new ArgumentException("ZoomFactor must be positive number");

Stoyan
  
Back to top
 
IP Logged
 
rajesh_patil74
Full Member
***
Offline


I love YaBB 1G - SP1!

Posts: 220
Joined: Sep 3rd, 2009
Re: ZoomFactor binding is not working
Reply #2 - Jan 28th, 2011 at 4:55am
Print Post  
Hi Stoyo

What I observed is that, when xaml file gets loaded the datacontext for the xaml page is not assinged and at that time exception gets raised since the value assinged in xmal exceutes the assingment statment and at that time value of zoomfactor is passed as 0.

-Rajesh
  
Back to top
WWW  
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: ZoomFactor binding is not working
Reply #3 - Jan 28th, 2011 at 8:56am
Print Post  
Hi,

Can't you set DataContext before the InitializeComponent call in the Page constructor?

Stoyan
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint