The Linux distillery
Moonlighting Linux: the future of rich web apps | Moonlighting Linux: the future of rich web apps |
|
| by David M Williams | |
| Thursday, 08 May 2008 | |
|
Page 3 of 4 If you built Moonlight yourself you have a brand new compiler called smcs which compiles Moonlight code. Actually, it will run on a Windows platform too, and compile your Silverlight code too.Featured Whitepaper
5 Best Practices for Smartphone Support
App.xaml lists all the resources used by the project; as you add more files – whether XAML or mp3 or jpg or any other item – they must be included here between a matching pair of <Application.Resources> ... </Application.Resources> tags. Page.xaml produces the opening user interface; most any complex piece of software will have multiple screens and dialogs in which case other XAML files will need to be added. However, you need at least one – else you have no user interface at all – and Page.xaml is that starting point. Within Page.xaml you will find a pair of <UserControl> ... </UserControl> tags. Here’s where you add all your markup tags to construct what the user will see. You can make a very simple interface, as proof that it works, by adding these tags: <StackPanel Background=”White”> <TextBox Width=”100” /> <Button Width=”100” Content=”Say Hello” /> </StackPanel> Compile this and open the provided HTML page within Firefox and if all is installed properly you will see a textbox and a button. That proves things work but isn’t terribly useful. In order to manipulate the controls we’ve put on the form we need to give them names; this lets them be referenced in program code. Modify the lines above like so: <TextBox Width=”100” x:Name=”txtHello” /> <Button Width=”100” Content=”Say Hello” x:Name=”btnHello”> Next, open Page.cs and find the line Public Page() near the top of the file. This routine runs whenever Page.xaml is loaded into a browser. Add a line to it, and a new routine underneath, like so: Public Page() { InitializeComponent(); btnHello.Click += new RoutedEventHandler(btnHello_Click); }
|
| < Next story in category | Previous story in the category > |
|---|








