This is a migrated thread and some comments may be shown as answers.

Doing Something Wrong...

2 Answers 70 Views
Gauge
This is a migrated thread and some comments may be shown as answers.
pmessina
Top achievements
Rank 1
pmessina asked on 04 Jan 2009, 03:10 PM
Ok I know I'm doing something wrong with these controls. I'm fairly new to Silverlight, but understand that basics of it. I grabbed the code from the gauge help section, but whenever I try to set its value from codebehind I get a null reference exception saying that the Linear Bar is null. What am I doing wrong? Also, the documentation is a bit soft. It may be a good idea instead of telling the developer that they can set the linear bar value from codebehind or have them search through buried code in an example base page, show a simple full example.

2 Answers, 1 is accepted

Sort by
0
Giuseppe
Telerik team
answered on 06 Jan 2009, 12:56 PM
Hello pmessina,

Indeed your observations are correct -- there is a Silverlight limitation that does not allow standard FindName(...) calls to find objects inside custom controls. As result objects like linearBar in your code are always null. To avoid this problem you should include following method to the code of your page (where radGauge is the name of your RadGauge instance):

 
public new object FindName(string name) 
    object child = base.FindName(name); 
  
    if (child == null
    { 
        child = radGauge.FindName(name); 
    } 
  
    return child; 
}  


We have updated your Telerik points for the feedback. We have attached a runnable sample application and will update the documentation article as well.


Sincerely yours,
Manuel
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
pmessina
Top achievements
Rank 1
answered on 06 Jan 2009, 01:00 PM
Thank you very much for the quick response.
Tags
Gauge
Asked by
pmessina
Top achievements
Rank 1
Answers by
Giuseppe
Telerik team
pmessina
Top achievements
Rank 1
Share this question
or