Page 1 of 1

WPF: A new 'old' thing...:)

Posted: Mon Apr 13, 2009 2:37 am
by Roberto Lopez
Hi All,

If you want to be 'in fashion', you must to learn to program Windows apps with the new Windows Presentation Foundation (WPF).

What is this?

Well... according MS official docs:

"Windows Presentation Foundation (WPF) is a next-generation presentation system for building Windows client applications... "

In short... you should describe your interface in an HTML style language (called XAML) and your code in a .NET language such as VB or C#.

Lets see a sample (I've removed some non relevant parts for clarity):

This is the interface:

Code: Select all

<Window

    Title="Window with Button"
    Width="250" Height="100">

  <Button Name="button" Click="button_Click">Click Me!</Button>

</Window>

And this is the code (VB):

Code: Select all

      Private Sub button_Click(ByVal sender As Object, ByVal e As RoutedEventArgs)

            ' Show message box when button is clicked
            MessageBox.Show("Hello, Windows Presentation Foundation!")

        End Sub

It looks like:

Image

Another sample:

This is a SPlitBox... ehmmm... sorry I mean a 'StackPanel' :)

Code: Select all

<StackPanel>  
   <TextBlock>My UI</TextBlock>  
   <ListBox>  
      <ListBoxItem>Item 1</ListBoxItem>  
      <ListBoxItem>Item 2</ListBoxItem>  
   </ListBox>  
   <RichTextBox/>  
</StackPanel>  
A screenshot for this:

Image

To use WPF you only need to download the .NET framework 3.x runtime (about 200 MB), Visual Studio 2008 and maybe some other 'little' tools.

Of course, your application probably will run terribly slow unless you have a very powerful computer.

Anyway... I must recognize that XAML coding style for the interface is not bad at all (I guess that it remembers me something... :) ).

Regards,

Roberto.

Re: WPF: A new 'old' thing...:)

Posted: Mon Apr 13, 2009 3:34 am
by Rathinagiri
I guess that it remembers me something...
Yep, It is obviously HMG! :mrgreen: :lol:

But, the only difference, perhaps is, HMG is fast in slower computers too. :idea:

Re: WPF: A new 'old' thing...:)

Posted: Mon Apr 13, 2009 7:51 am
by swapan
Can we achieve this kind of interface, looks in HMG?

-- Swapan

Re: WPF: A new 'old' thing...:)

Posted: Mon Apr 13, 2009 8:51 am
by Rathinagiri
Why not? Even now we can, if we use Vista.

Re: WPF: A new 'old' thing...:)

Posted: Mon Apr 13, 2009 12:27 pm
by Roberto Lopez
swapan wrote:Can we achieve this kind of interface, looks in HMG?

-- Swapan
Yes, of course if you use Vista default theme:

Image

Re: WPF: A new 'old' thing...:)

Posted: Mon Apr 13, 2009 6:16 pm
by dhaine_adp
Code:
<Window

Title="Window with Button"
Width="250" Height="100">

<Button Name="button" Click="button_Click">Click Me!</Button>

</Window>
Looks like if the need arise, HMG code can be easily translated to this syntax and vice versa. But still prefer HMG....powerful yet very simple.