Can one declare everything at runtime?

1 posts, 0 answers
  1. William
    William avatar
    14 posts
    Member since:
    Jan 2010

    Posted 01 Jul 2011 Link to this post

    Is XAML really necessary?  If someone really wanted to, could everything displayed on a Silverlight page be declared at runtime in the C# code?
    VISIFire has example code where they set up one of their classes, chart, in the C# code and then simply add it to the user interface with a simple C# call:

    LayoutRoot.Children.Add(chart);
    How would I do a similar creation with a class I already have defined in the XAML file but because of other reasons I need to declare it at runtime?  If I could use it as it is in XAML I think it would work because there are no errors with its display.  It is declared like this:

     

     <views:PrescriberPage01 x:Name="DashboardPrescriberPage01" Visibility="Collapsed" SelectedProduct="{Binding SelectedProduct, Mode=TwoWay}"Grid.Row ="0"/>

     

    How would I declare that in C# code?

Back to Top