Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

Inline function within XAML

Most of the time, the event in Xaml is assigned to a codebehind function
Example:
*.xaml
<button click="OnBtnClicked" content="Click Me" height="30" name="btn" width="80"></button>
*.cs
void OnBtnClicked(object sender, RoutedEventArgs e)
{
        btn.Content = "Thank you";
}


Another way is to use Inline code in the XAML file by using <x:code> element.
<button click="OnBtnClicked" content="Click Me" height="30" name="btn" width="80">
  <x:code>
    <![CDATA[
      void OnBtnClicked(object sender, RoutedEventArgs e)
      {
        btn.Content = "Thank you";
      }
    ]]>
  </x:code>
</button>


This post first appeared on Plain Column, please read the originial post: here

Share the post

Inline function within XAML

×

Subscribe to Plain Column

Get updates delivered right to your inbox!

Thank you for your subscription

×