Page 1 of 2 12 LastLast
Results 1 to 16 of 17

Thread: How cool is xaml and WPF/.NET 3(.5)? :)

  1. #1
    Theoretical Element Spud1's Avatar
    Join Date
    Jul 2003
    Location
    North West
    Posts
    7,508
    Thanks
    336
    Thanked
    320 times in 255 posts
    • Spud1's system
      • Motherboard:
      • Gigabyte Aorus Master
      • CPU:
      • 9900k
      • Memory:
      • 16GB GSkill Trident Z
      • Storage:
      • Lots.
      • Graphics card(s):
      • RTX3090
      • PSU:
      • 750w
      • Case:
      • BeQuiet Dark Base Pro rev.2
      • Operating System:
      • Windows 10
      • Monitor(s):
      • Asus PG35VQ
      • Internet:
      • 910/100mb Fibre

    How cool is xaml and WPF/.NET 3(.5)? :)

    As title really

    I'm writing an interface at the moment in WPF/.NET3, using primarily XAML and a bit of C# codebehind for animations etc..and just thought I would mention how nice it is to use - a real step up from the WinForms of the past.
    Orcas is a great tool for developing it with (as long as you ignore the designer), even with the intellisense bugs that exist at the moment..but then you have to forgive it that at the moment as it is a Microsoft beta after all

    Some examples of why I think its cool? Lets take how simple it is to create a control and apply a style/layout to a range of them..for example Textblocks.

    You create your textblocks, as shown below:

    Code:
    <TextBlock Text="Text" />
    As you can see, it looks just like a bit of XHTML code, or XML The above tag is like a label of winforms, but much more flexible. I could also specify that block like this if I wanted, which is suitable for longer lines of text.

    Code:
    <TextBlock>
    	This is a longer line of text!
    </TextBlock>
    To add more properties to this textblock, you can do things in a multitude of ways..for example, if you just wanted to apply the property to this single block, you could do this:

    Code:
    <TextBlock x:Name="txtblkTextBlock1" FontWeight="Bold" FontSize="12" TextWrapping="Wrap">
    	This is bold text, of size 12 which will wrap accross multiple lines!
    </TextBlock>
    Or, this codeblock does exactly the same thing.

    Code:
    <TextBlock x:Name="txtblkTextBlock1">
    	<TextBlock.FontWeight>
    		Bold
    	</TextBlock.FontWeight>
    	<TextBlock.FontSize>
    		12
    	</TextBlock.FontSize>
    	<TextBlock.TextWrapping>
    		Wrap
    	</TextBlock.TextWrapping>
    	This is bold text, of size 12 which will wrap accross multiple lines, declared using property tags!
    </TextBlock>
    but what if you wanted to apply the above style to lots of textblocks? Thats simple too, and works in a similar way to CSS. You simply add a resource section to your application, with code like this. Your basically giving the codeblock a class (the 'Key'), a type ('x:Type'), and then setting each property (the 'Setter's), which can also be written out in the long <Style.Setter.Property.PropertyName> format if you do desire.

    Code:
    <Window.Resources>
    	<Style x:Key="ExampleTextStyle" TargetType="{x:Type TextBlock}">
    		<Setter Property="FontWeight" Value="Bold" />
    		<Setter Property="FontSize" Value="12" />
    		<Setter Property="TextWrapping" Value="Wrap" />
    	</Style>
    </Window.Resources>
    and then replace all your property tags with a single ID, like so

    Code:
    <TextBlock x:Name="txtblkTextBlock1" Style="{StaticResource ExampleTextStyle}" >
    	This is a styled textblock!
    </TextBlock>
    Simple! Thats just a very basic example, you can get much more complex with nested blocks/controls, clever animations, transformations, gradients etc..all with the same sort of familiar XML/XHTML like syntax.

    It can make GUI programming so much easier to visualise, especially if you come to Windows programming from a primarily web based background. Another advantage is that everything produced with WPF uses vector graphics, meaning it looks great at almost any resolution or zoom level - this is also what gives it the transformation power, allowing you to manipulate any aspect of the interface on the fly without having to design the artwork first of all (eg a rotating image is a simple, 3 lines of C# code ) I've not even touched on the layout managers and new methods of relative positioning which make auto-resizing very simple to do - without the typical layout nightmares that relative positions/auto-resizing usually causes with desktop applications..or for that matter WPF/E (silverlight), which is WPF for web browsers (the next step up from ASP.NET).

    Anyway just wanted to share with you all some of the cool things I've found about WPF since I've been learning it today..I was convinced that .NET was the future of Windows programming when verison 2.0 was released..but with 3.0 and 3.5(beta) I am even more convinced lol
    Last edited by Spud1; 24-07-2007 at 12:15 AM.

  2. #2
    Member
    Join Date
    Jul 2006
    Posts
    83
    Thanks
    0
    Thanked
    10 times in 9 posts
    Yeah, there are a lot of new things to look forward to for programmers in the next few months. The two things I'm really looking forward to are the new VS 2008 with .NET 3.0 and the new Xcode 3.0 with Objective C 2.0.

  3. #3
    Large Member
    Join Date
    Apr 2004
    Posts
    3,720
    Thanks
    47
    Thanked
    99 times in 64 posts
    You have the complement the W3C with the great work they have done with standards. I mean after all the syntax is XML or one of its related W3C standards.
    To err is human. To really foul things up ... you need a computer.

  4. #4
    Senior Member Kezzer's Avatar
    Join Date
    Sep 2003
    Posts
    4,863
    Thanks
    12
    Thanked
    5 times in 5 posts
    I think it should have been done like this years ago. Graphical elements only need markup language in my opinion. The only argument against it is that it may not provide the additional granularity, but I'm sure they would have implemented some flags to counter against this.

  5. #5
    Large Member
    Join Date
    Apr 2004
    Posts
    3,720
    Thanks
    47
    Thanked
    99 times in 64 posts
    CSS, XSLT, SVG? I thought they had been around for years.
    To err is human. To really foul things up ... you need a computer.

  6. #6
    Theoretical Element Spud1's Avatar
    Join Date
    Jul 2003
    Location
    North West
    Posts
    7,508
    Thanks
    336
    Thanked
    320 times in 255 posts
    • Spud1's system
      • Motherboard:
      • Gigabyte Aorus Master
      • CPU:
      • 9900k
      • Memory:
      • 16GB GSkill Trident Z
      • Storage:
      • Lots.
      • Graphics card(s):
      • RTX3090
      • PSU:
      • 750w
      • Case:
      • BeQuiet Dark Base Pro rev.2
      • Operating System:
      • Windows 10
      • Monitor(s):
      • Asus PG35VQ
      • Internet:
      • 910/100mb Fibre
    They have been around for years - but the point here isnt XML, CSS etc; its how they have been integrated into .NET, and how it simplifies .NET programming

  7. #7
    Seething Cauldron of Hatred TheAnimus's Avatar
    Join Date
    Aug 2005
    Posts
    17,168
    Thanks
    803
    Thanked
    2,152 times in 1,408 posts
    hush Spud1, remeber MS never do anything good or clever, they are just pure evil.

    I'm guessing he hasn't come accross any of WPF (Windows Presentation Foundation). And as such can't see the GUI through the markup.

    The point of this is how making the GUI can be simplified, its only a matter of time until there is full seperation between presentation and data.

    (also its worth mentioning 'mr xml' (Jean Poali) works for ms, why do you think even office is using it now!)
    throw new ArgumentException (String, String, Exception)

  8. #8
    Large Member
    Join Date
    Apr 2004
    Posts
    3,720
    Thanks
    47
    Thanked
    99 times in 64 posts
    Yes I only happen to use .NET practically every day. You seem to have missed my point.
    To err is human. To really foul things up ... you need a computer.

  9. #9
    Registered+
    Join Date
    Jul 2005
    Location
    Richmond, London
    Posts
    75
    Thanks
    0
    Thanked
    0 times in 0 posts
    XAML isn't really anything new. Take a look at XUL (the Extensible User-interface Language that Mozilla Firefox is built on). The problem is, the way MS have implemented XAML is horrifically backwards thinking. Take a look at your own example there:

    Code:
    <TextBlock x:Name="txtblkTextBlock1">
    	<TextBlock.FontWeight>
    		Bold
    	</TextBlock.FontWeight>
    	<TextBlock.FontSize>
    		12
    	</TextBlock.FontSize>
    	<TextBlock.TextWrapping>
    		Wrap
    	</TextBlock.TextWrapping>
    	This is bold text, of size 12 which will wrap accross multiple lines, declared using property tags!
    </TextBlock>
    So there you have two different style attributes being defined via the actual markup? Doesn't this remind anyone of the bad old days of HTML wherein style, content and structure all sat alongside each other in a tag soup (the <font> tag springs immediately to mind)? MS had a wonderful opportunity to embrace the standards in use today and make it easy for web developers to make the switch to full-on application development, but instead of separating out structure, presentation and behaviour in a sensible way (using something like stylesheets), you have this horrific mess. I know your example is simple enough, but I've played around with more complicated application examples and the markup is horrendous. It's essentially impossible to work with in text-form in most cases, and so you'll be tied to visual editing tools ......made by Microsoft!

    A real shame, if you ask me.

  10. #10
    Registered+
    Join Date
    Jul 2005
    Location
    Richmond, London
    Posts
    75
    Thanks
    0
    Thanked
    0 times in 0 posts
    That all said, I'm not a Win32 developer and so I can't comment on how much better than the old ways this new stuff is. I'm sure it's better; it just could have been even better.

  11. #11
    Lovely chap dangel's Avatar
    Join Date
    Aug 2005
    Location
    Cambridge, UK
    Posts
    8,398
    Thanks
    412
    Thanked
    459 times in 334 posts
    • dangel's system
      • Motherboard:
      • See My Sig
      • CPU:
      • See My Sig
      • Memory:
      • See My Sig
      • Storage:
      • See My Sig
      • Graphics card(s):
      • See My Sig
      • PSU:
      • See My Sig
      • Case:
      • See My Sig
      • Operating System:
      • Windows 10
      • Monitor(s):
      • See My Sig
      • Internet:
      • 60mbit Sky LLU
    The amusing thing is how much time and effort people have spent with Windows Forms only to have MS effectively kill them off with XAML. You won't be tied to anything - there are already third party tools that can export things like 3d models directly to XAML for example (you wanna see the markup for a big assembly lol) - but it will take time for the Dev tools to mature to the same extent as they have for past architectures. Expression is coming along but we need a new VS with proper integration before it'll become workable. MS haven't excluded third partys - it's effectively a wide-open standard (albeit MS' one) - but people will end up using the MS dev tools for the same reason as they've always done: they're just better than the opposition (they're far from perfect tho).
    Last edited by dangel; 26-07-2007 at 01:36 PM.
    Crosshair VIII Hero (WIFI), 3900x, 32GB DDR4, Many SSDs, EVGA FTW3 3090, Ethoo 719


  12. #12
    Comfortably Numb directhex's Avatar
    Join Date
    Jul 2003
    Location
    /dev/urandom
    Posts
    17,074
    Thanks
    228
    Thanked
    1,026 times in 677 posts
    • directhex's system
      • Motherboard:
      • Asus ROG Strix B550-I Gaming
      • CPU:
      • Ryzen 5900x
      • Memory:
      • 64GB G.Skill Trident Z RGB
      • Storage:
      • 2TB Seagate Firecuda 520
      • Graphics card(s):
      • EVGA GeForce RTX 3080 XC3 Ultra
      • PSU:
      • EVGA SuperNOVA 850W G3
      • Case:
      • NZXT H210i
      • Operating System:
      • Ubuntu 20.04, Windows 10
      • Monitor(s):
      • LG 34GN850
      • Internet:
      • FIOS
    /me flings some glade XML and gtk# around

  13. #13
    Lovely chap dangel's Avatar
    Join Date
    Aug 2005
    Location
    Cambridge, UK
    Posts
    8,398
    Thanks
    412
    Thanked
    459 times in 334 posts
    • dangel's system
      • Motherboard:
      • See My Sig
      • CPU:
      • See My Sig
      • Memory:
      • See My Sig
      • Storage:
      • See My Sig
      • Graphics card(s):
      • See My Sig
      • PSU:
      • See My Sig
      • Case:
      • See My Sig
      • Operating System:
      • Windows 10
      • Monitor(s):
      • See My Sig
      • Internet:
      • 60mbit Sky LLU
    And?
    lol.
    Crosshair VIII Hero (WIFI), 3900x, 32GB DDR4, Many SSDs, EVGA FTW3 3090, Ethoo 719


  14. #14
    Comfortably Numb directhex's Avatar
    Join Date
    Jul 2003
    Location
    /dev/urandom
    Posts
    17,074
    Thanks
    228
    Thanked
    1,026 times in 677 posts
    • directhex's system
      • Motherboard:
      • Asus ROG Strix B550-I Gaming
      • CPU:
      • Ryzen 5900x
      • Memory:
      • 64GB G.Skill Trident Z RGB
      • Storage:
      • 2TB Seagate Firecuda 520
      • Graphics card(s):
      • EVGA GeForce RTX 3080 XC3 Ultra
      • PSU:
      • EVGA SuperNOVA 850W G3
      • Case:
      • NZXT H210i
      • Operating System:
      • Ubuntu 20.04, Windows 10
      • Monitor(s):
      • LG 34GN850
      • Internet:
      • FIOS
    nah, in seriousness, i think i can see part of the thinking behind the more bizarre mixed-data layout of XAML - the further from pixel-specific placement that veteran winforms coders are taken, the more they'll scream blue murder.

    personally i hate the absolute positioning of winforms, and welcome anything that'll help to end such dark-age design practices. but i think kapowaz is a little hard on microsoft with his synopsis - "horrifically backwards thinking"? way to describe far too many coders - the ones who'll be insisting that they'll never move up from vb6 because .net is obviously slow and bloated and nasty and doesn't love them anymore

    i hate microsoft's broken xml (xaml, office xml) but whatever happens, it's an improvement on what came before

  15. #15
    Registered+
    Join Date
    Jul 2005
    Location
    Richmond, London
    Posts
    75
    Thanks
    0
    Thanked
    0 times in 0 posts
    Quote Originally Posted by directhex View Post
    nah, in seriousness, i think i can see part of the thinking behind the more bizarre mixed-data layout of XAML - the further from pixel-specific placement that veteran winforms coders are taken, the more they'll scream blue murder.

    personally i hate the absolute positioning of winforms, and welcome anything that'll help to end such dark-age design practices. but i think kapowaz is a little hard on microsoft with his synopsis - "horrifically backwards thinking"? way to describe far too many coders - the ones who'll be insisting that they'll never move up from vb6 because .net is obviously slow and bloated and nasty and doesn't love them anymore
    There's absolutely no reason that whatever alternative technology they'd come up with could have given just as much pixel-precise position as they want - after all, you can create an interface in XUL/CSS and have it appear exactly how you want with absolute certainty on all platforms.

    The reason I'm hard on MS is because they really don't ought not have people developing languages who're unaware of the history behind HTML and tag soup, and regardless of purpose, HTML was the inspiration for XAML (even if it was indirectly, via XUL). The lessons learned from that as to why structure and presentation should be separate ought to have been applied, but clearly weren't. If I hold them to a high standard it's because they certainly have the resources to do the best possible job.

    But you may well be right; if people aren't even willing to make the leap from VB6 to .NET then this will largely be irrelevent to them (although frankly, if you're still making a living from VB6 apps then you've either hit a goldmine or you've closed yourself off to the cash cow that is the web).

  16. #16
    Seething Cauldron of Hatred TheAnimus's Avatar
    Join Date
    Aug 2005
    Posts
    17,168
    Thanks
    803
    Thanked
    2,152 times in 1,408 posts
    Quote Originally Posted by kapowaz View Post
    There's absolutely no reason that whatever alternative technology they'd come up with could have given just as much pixel-precise position as they want - after all, you can create an interface in XUL/CSS and have it appear exactly how you want with absolute certainty on all platforms.

    The reason I'm hard on MS is because they really don't ought not have people developing languages who're unaware of the history behind HTML and tag soup, and regardless of purpose, HTML was the inspiration for XAML (even if it was indirectly, via XUL). The lessons learned from that as to why structure and presentation should be separate ought to have been applied, but clearly weren't. If I hold them to a high standard it's because they certainly have the resources to do the best possible job.

    But you may well be right; if people aren't even willing to make the leap from VB6 to .NET then this will largely be irrelevent to them (although frankly, if you're still making a living from VB6 apps then you've either hit a goldmine or you've closed yourself off to the cash cow that is the web).
    'Mr XML' isn't aware of the history?

    I think your getting a markup language for a GUI with HTML. This is simply about presentation, not about data?
    throw new ArgumentException (String, String, Exception)

Page 1 of 2 12 LastLast

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •