Doing Something Wrong...

3 posts, 0 answers
  1. pmessina
    pmessina avatar
    13 posts
    Member since:
    Feb 2007

    Posted 04 Jan 2009 Link to this post

    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. Giuseppe
    Admin
    Giuseppe avatar
    2363 posts

    Posted 06 Jan 2009 Link to this post

    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.
  3. DevCraft banner
  4. pmessina
    pmessina avatar
    13 posts
    Member since:
    Feb 2007

    Posted 06 Jan 2009 Link to this post

    Thank you very much for the quick response.
Back to Top