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,079
    Thanks
    262
    Thanked
    268 times in 211 posts
    • Spud1's system
      • Motherboard:
      • Mac Pro
      • CPU:
      • 2x 2.8ghz Quad Core Xeons (octo-core)
      • Memory:
      • 4gb DDR2 FB-Dimm
      • Storage:
      • 1x1TB, 1x320gb, 2x500gb, 1x250gb, 120GB SSD
      • Graphics card(s):
      • Nvidia Geforce 560Ti
      • PSU:
      • Mac pro PSU
      • Case:
      • Mac Pro Case
      • Operating System:
      • Windows 8
      • Monitor(s):
      • 1x22" LG 3D TFT 1x 19" ViewSonic
      • Internet:
      • 80mb BT Infinity

    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
    82
    Thanks
    0
    Thanked
    8 times in 8 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,079
    Thanks
    262
    Thanked
    268 times in 211 posts
    • Spud1's system
      • Motherboard:
      • Mac Pro
      • CPU:
      • 2x 2.8ghz Quad Core Xeons (octo-core)
      • Memory:
      • 4gb DDR2 FB-Dimm
      • Storage:
      • 1x1TB, 1x320gb, 2x500gb, 1x250gb, 120GB SSD
      • Graphics card(s):
      • Nvidia Geforce 560Ti
      • PSU:
      • Mac pro PSU
      • Case:
      • Mac Pro Case
      • Operating System:
      • Windows 8
      • Monitor(s):
      • 1x22" LG 3D TFT 1x 19" ViewSonic
      • Internet:
      • 80mb BT Infinity
    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,147
    Thanks
    798
    Thanked
    2,151 times in 1,407 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,385
    Thanks
    407
    Thanked
    449 times in 331 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.
    System 001: Maximus VII Formula, 4790k i7, RTX 2080ti FE (incoming), 16GIG Corsair Vengence DDR3 RAM CL9, Corsair HX1000, ROG SWIFT PG278Q , SSDs, Antec 1200 case, All watercooled. [main]
    System 002: A8 3850 APU, ASUS uATX FM1A75 MB, 4GB Corsair Vengeance DDR3, Corsair psu, OCZ Agility 3, 1TB F3, Dell 2001FP 20" LCD, £7's worth of 5.1 speakers (they rock) Windows 7 x64[wife/server]
    System 003: AsRock MB, APU, 8 GIG Corsair, Silverstone HTPC case, stock cooler, GT220 1gbDDR3, WD Green 3TB, Kingston 40gb SSD, MCE Remote, Panasonic 50" LCD (87BDX) via HDMI Windows 8.1.1 (32) [media centre]
    System 004: Asus UL50AT Intel Core 2 Duo,4GB, Intel Gen 2 80GB SSD, Win 8.1.1 x64 [no justification]
    System 005: HP Proliant N40L Microserver, 4x2TB drives, fan mod, Pico PSU mod, Win7 x86 [file server]
    System 006: Dell Optiplex 9010, i7, 8gb, 128gb Samsung 830 x 2 (boot and VM drive), 1TB WD HDD, ATI something, Windows 8.1.1 x64 RTM [work]


  12. #12
    Vive le pants! directhex's Avatar
    Join Date
    Jul 2003
    Location
    /dev/urandom
    Posts
    17,074
    Thanks
    228
    Thanked
    1,027 times in 678 posts
    • directhex's system
      • Motherboard:
      • MSI X99A Gaming 7
      • CPU:
      • Intel Core i7 5280k
      • Memory:
      • 32GiB ADATA DDR4
      • Storage:
      • Corsair Neutron XT 960GB
      • Graphics card(s):
      • MSI GTX 980 Gaming 4G Twin Frozr 5
      • PSU:
      • Corsair AX860i
      • Case:
      • NZXT H440
      • Operating System:
      • Ubuntu 17.10, Windows 10
      • Monitor(s):
      • Dell U2713HM
      • 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,385
    Thanks
    407
    Thanked
    449 times in 331 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.
    System 001: Maximus VII Formula, 4790k i7, RTX 2080ti FE (incoming), 16GIG Corsair Vengence DDR3 RAM CL9, Corsair HX1000, ROG SWIFT PG278Q , SSDs, Antec 1200 case, All watercooled. [main]
    System 002: A8 3850 APU, ASUS uATX FM1A75 MB, 4GB Corsair Vengeance DDR3, Corsair psu, OCZ Agility 3, 1TB F3, Dell 2001FP 20" LCD, £7's worth of 5.1 speakers (they rock) Windows 7 x64[wife/server]
    System 003: AsRock MB, APU, 8 GIG Corsair, Silverstone HTPC case, stock cooler, GT220 1gbDDR3, WD Green 3TB, Kingston 40gb SSD, MCE Remote, Panasonic 50" LCD (87BDX) via HDMI Windows 8.1.1 (32) [media centre]
    System 004: Asus UL50AT Intel Core 2 Duo,4GB, Intel Gen 2 80GB SSD, Win 8.1.1 x64 [no justification]
    System 005: HP Proliant N40L Microserver, 4x2TB drives, fan mod, Pico PSU mod, Win7 x86 [file server]
    System 006: Dell Optiplex 9010, i7, 8gb, 128gb Samsung 830 x 2 (boot and VM drive), 1TB WD HDD, ATI something, Windows 8.1.1 x64 RTM [work]


  14. #14
    Vive le pants! directhex's Avatar
    Join Date
    Jul 2003
    Location
    /dev/urandom
    Posts
    17,074
    Thanks
    228
    Thanked
    1,027 times in 678 posts
    • directhex's system
      • Motherboard:
      • MSI X99A Gaming 7
      • CPU:
      • Intel Core i7 5280k
      • Memory:
      • 32GiB ADATA DDR4
      • Storage:
      • Corsair Neutron XT 960GB
      • Graphics card(s):
      • MSI GTX 980 Gaming 4G Twin Frozr 5
      • PSU:
      • Corsair AX860i
      • Case:
      • NZXT H440
      • Operating System:
      • Ubuntu 17.10, Windows 10
      • Monitor(s):
      • Dell U2713HM
      • 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,147
    Thanks
    798
    Thanked
    2,151 times in 1,407 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
  •