15
2006
Random thoughts == System.Random(object thought)
This is the state of my mind at this precise moment. Thinking of code as well as trying to think of something else. Its Friday night, I’ve had my dinner and am really tired to do any more work. Thought of updating my blog, as it has been weeks since I last did it. Just when I had thought I was going to be working on Java at Trilogy, I changed my plans for no apparent reason and came to Microsoft. Here one, obviously, won’t work on Java. But imagine my luck, I got to work on its cousin or should I say successor (as Microsoft would like to see it IMHO; I don’t express any opinions about and of the company, this is a personal blog). This is really cool, I mean working in a familiar domain, with System.Console.println replaced by System.Console.WriteLine most of the things are same. What is not same is the GUI features provided by WinFX or Avalon framework. They are really cool, I mean we can use markup to generate complete UIs which are absolutely STUNNING. In Java or even VC++, I would have to spend hours to write the code, but thanks to the combination of C# and XAML, its a piece of cake to do so.
XAML, the new tool (pronounced zammel) XAML is an XML based system to create GUIs. BUt it can do much more than that. It provides for cool concepts like data binding. This is something like an element will automatically update its properties based on the properties of another element. So you can have the color of text in a TextBox to be the same as the Background of the Button which is an image. It as simple as writing a markup without any lines of code in C#. The power of XAML is truly phenomenal! Code:
<Page xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns: sys="clr-namespace: System;assembly=mscorlib"
xmlns: x="http://schemas.microsoft.com/winfx/2006/xaml" >
<Page.Resources>
<ImageBrush x:Key="SomeImage" ImageSource="C:\\Documents and Settings\\All Users\\Documents\\My Pictures\\Sample Pictures\\Sunset.jpg"/>
</Page.Resources>
<StackPanel Height="150" Width="350">
<Button Background="{StaticResource SomeImage}" Name="button" Height="60"/>
<TextBox Foreground="{Binding Path=Background, ElementName=button}" FontSize="20">
Some Text with a picture background
</TextBox>
</StackPanel>
</Page>
And the result!
Isn’t this great? Just a few lines of code was needed to produce such an application!
Somehow my spam filter correctly recogonizes your comments as spam :-?
I wrote about it to show the power of XAML and the new WinFX. It would take a lot of burden away from the programmers who would have to manually write and sync code and design. Working with IDEs like Netbeans for Java provided some flexibility with GUI design but then it was tough… try editing one line in the IDE generated code and the whole thing would complain! Here, this is a seperate job in itself. Though the GUI designing feature for XAML is still buggy (so buggy that I try not to go into that mode in VS 2005!) it represents what we can expect in the future in terms of ease of design as well as coding.
Hope this made sense
A good article.keep writing stuff like this