Powered by MSDN

US - English
NEW! Silverlight 5 is available Learn More

XAML or code-behind RSS

5 replies

Last post Jan 11, 2011 05:25 AM by thaicarrot

(0)
  • aldoweh

    aldoweh

    Member

    59 Points

    25 Posts

    XAML or code-behind

    Jan 08, 2011 08:05 PM | LINK

    In which cases it is better to use XAML and when do you use code-behind in the SL4 applications?
    For example when you create a datasource...

    Thanks!

    XAML code-behind

    If this has answered your question, please click on "Mark as Answer" on this post.
  • thaicarrot

    thaicarrot

    All-Star

    16588 Points

    4351 Posts

    Re: XAML or code-behind

    Jan 09, 2011 03:41 AM | LINK

    Hi,

    When you design UI interface use XAML. If you want create complicate UI or complicate animation go in code behind. becuse there has a limit when using XAML.

    If create Datasource go in code behind because if we create in XAML some time cannot solve the problem. Depend on you.

    Regards

    Best Regards
    Weera

  • syed amjad

    syed amjad

    Star

    9721 Points

    1823 Posts

    Re: XAML or code-behind

    Jan 10, 2011 05:29 AM | LINK

    Hi,

    Use XAML for UI Designing like placeing controls, Storyboards etc.

    Use Code Behind .cs page to write the runtime code which helps in debugging and will solve many problems later like performance.

    The Basic idea behind separating .xaml and .cs pages is to develop projects parallel from both side designing and programming.

    Thanks & Regards
    Syed Amjad
    Silverlight Developer
    follow me on skype : syed.amjad0786
    Mark as Answer", if it helped you or it might help others too.
  • PaulHMason

    PaulHMason

    Member

    76 Points

    16 Posts

    Re: Re: XAML or code-behind

    Jan 10, 2011 05:50 AM | LINK

    Ideally, you should have little or no code behind.  I've found that the MVVM pattern is very useful for creating maintainable Silverlight and WPF applications.  There are a number of good MVVM frameworks, and some good guidance in the Prism documentation (not related to Prism).

  • aldoweh

    aldoweh

    Member

    59 Points

    25 Posts

    Re: Re: Re: XAML or code-behind

    Jan 10, 2011 08:39 AM | LINK

    If I like to have an application "MVVM ready" is it better to use the code behind for the datasources?

    If this has answered your question, please click on "Mark as Answer" on this post.
  • thaicarrot

    thaicarrot

    All-Star

    16588 Points

    4351 Posts

    Re: Re: Re: XAML or code-behind

    Jan 11, 2011 05:25 AM | LINK

    Hi,

    If you like to have an application with MVVM no need to set DataSource in code behind.

    Take a look at this link http://msdn.microsoft.com/en-us/library/gg406140.aspx.

    Thanks and Best Regards

    Best Regards
    Weera