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

Other General Resources like icon sets, sound files etc.,

Moderator: Rathinagiri

Post Reply
User avatar
Roberto Lopez
HMG Founder
Posts: 3902
Joined: Wed Jul 30, 2008 6:43 pm
Has thanked: 13 times
Been thanked: 137 times

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

Post by Roberto Lopez » Mon Apr 13, 2009 2:37 am

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.
Regards/Saludos,

Roberto


(Veritas Filia Temporis)

User avatar
Rathinagiri
Posts: 5181
Joined: Tue Jul 29, 2008 6:30 pm
DBs Used: MariaDB, SQLite, SQLCipher and MySQL
Location: Sivakasi, India
Has thanked: 141 times
Been thanked: 131 times
Contact:

Post by Rathinagiri » Mon Apr 13, 2009 3:34 am

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:
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.

User avatar
swapan
Posts: 242
Joined: Mon Mar 16, 2009 4:23 am
Location: Kolkata, India
Contact:

Post by swapan » Mon Apr 13, 2009 7:51 am

Can we achieve this kind of interface, looks in HMG?

-- Swapan
Thanks & Regards,
Swapan Das

http://www.swapandas.com/

User avatar
Rathinagiri
Posts: 5181
Joined: Tue Jul 29, 2008 6:30 pm
DBs Used: MariaDB, SQLite, SQLCipher and MySQL
Location: Sivakasi, India
Has thanked: 141 times
Been thanked: 131 times
Contact:

Post by Rathinagiri » Mon Apr 13, 2009 8:51 am

Why not? Even now we can, if we use Vista.
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.

User avatar
Roberto Lopez
HMG Founder
Posts: 3902
Joined: Wed Jul 30, 2008 6:43 pm
Has thanked: 13 times
Been thanked: 137 times

Post by Roberto Lopez » Mon Apr 13, 2009 12:27 pm

swapan wrote:Can we achieve this kind of interface, looks in HMG?

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

Image
Regards/Saludos,

Roberto


(Veritas Filia Temporis)

User avatar
dhaine_adp
Posts: 457
Joined: Wed Aug 06, 2008 12:22 pm
Location: Manila, Philippines
Been thanked: 1 time

Post by dhaine_adp » Mon Apr 13, 2009 6:16 pm

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.
Regards,

Danny
Manila, Philippines

Post Reply