Partilhar via


Xaml Inline coding

One interesting aspect is Xaml is that you can have inline code.... the syntax is as below

<

Window x:Class="WindowsApplication1.Window1"
xmlns="https://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="https://schemas.microsoft.com/winfx/2006/xaml"
Loaded="Window1_Loaded">
<x:Code>
<![CDATA[
              void Window1_Loaded(object sender, RoutedEventArgs e)
{
this.Title="yoohoo";
                   TextBox tb = new TextBox();
tb.Text="hello world";
this.Content=tb;
}
       ]]>
</x:Code>
</Window>

Comments

  • Anonymous
    October 06, 2006
    The comment has been removed
  • Anonymous
    October 06, 2006
    I bet the designers did give this a thought and incorporated the best features in Xaml... Also, XML is probably the most popular and widespread - So IMHO its likely that any new markup lang will have to follow similar patterns. ;)