XAML and Xamlon.com : Hello World!

Tags: Tech Geek

So Im sure most of you have heard about Xamlon.com now, and the fact that they have a XAML runtime library which targets the .NET Framework 1.1. I decided to put together a "Hello World" app like many have done before me.

My Code:
HelloWorld.xaml
-------------------

<?Mapping XmlNamespace="events" ClrNamespace="Rob.Events" Assembly="HelloWorld" ?>
<Border
    xmlns="http://schemas.microsoft.com/2003/xaml"
    xmlns:def="Definition"
    def:Class="Rob.Events.EventHandler"
    Background="White"
    BorderBrush="Black"
    BorderThickness="3"
    >
    <DockPanel>
        <Button Click="OnClick" Width="100" Height="50">Press Me!</Button>
        <TextBox ID="HelloTextBox" Width="400" Dock="Left"></TextBox>
    </DockPanel>

</Border>

and now the HelloWorld.cs:

using System;
using System.Windows.Forms;

using Xamlon.Windows;
using Xamlon.Windows.Controls;

namespace Rob.Events{
 public class EventHandler {
  public void OnClick(object sender, EventArgs e)  {
   // Get a reference to the Controls
   Xamlon.Windows.ControlDictionary controls = 
    Xamlon.Windows.Application.Current.Resources["Id"] as Xamlon.Windows.ControlDictionary;
   
   // Get a ref to the browser control
   Control HelloTextBox = controls["HelloTextBox"];
   HelloTextBox.Text="Hello World";

  }
 }
}


And finally lets compile it:


csc /t:library /r:..\lib\Xamlon.dll HelloWorld.cs

(notice the reference made to their DLL)

And then double click the HelloWorld.xaml file, and viola, the app loads.

My firts XAML App, inst she cute?

 

No Comments