Results 1 to 33 of 33

Thread: WPF tips and tricks on beautifying a form/control

  1. #1

    Thread Starter
    Software Carpenter dee-u's Avatar
    Join Date
    Feb 2005
    Location
    Pinas
    Posts
    11,127

    Arrow WPF tips and tricks on beautifying a form/control

    Aesthetics is one of WPF's strength against WinForms and as such I wish to know some tricks and tips on beautifying a form/control such as putting a gradient, skinning, etc...

    Care to share some?
    Regards,


    As a gesture of gratitude please consider rating helpful posts. c",)

    Some stuffs: Mouse Hotkey | Compress file using SQL Server! | WPF - Rounded Combobox | WPF - Notify Icon and Balloon | NetVerser - a WPF chatting system

  2. #2
    Frenzied Member vbNeo's Avatar
    Join Date
    May 2002
    Location
    Jutland, Denmark
    Posts
    1,994

    Re: WPF tips and tricks on beautifying a form/control

    It's important to note that a Form control is just like any other element in WPF, and as such the only limits the style you create is your imagination(Well, not really - but you know what I mean).

    I find it important to not overstyle everything. Even though it's cool that you can do all this new stuff, you should be careful that you're still ending up with an interface that is somewhat recognizable to the user - something they're used to.

    My advice is; don't use the new aesthetic features just because you can, do it in a way that fits into context, and that benefits the user of your application.

    PS: I might've misunderstood your question. If you wish to learn how to apply styles to UI elements there are loads of tutorials about it on the web .
    "Lies, sanctions, and cruise missiles have never created a free and just society. Only everyday people can do that."
    - Zack de la Rocha


    Hear me roar.

  3. #3

    Thread Starter
    Software Carpenter dee-u's Avatar
    Join Date
    Feb 2005
    Location
    Pinas
    Posts
    11,127

    Re: WPF tips and tricks on beautifying a form/control

    Don't worry about overstyling, I need to at learn how to style at least.

    I want to dig into its aesthetic features just so the users may notice that I used WPF instead of WinForms.

    When I have more time I will go on searching but if you have something in your sleeves then I'd appreciate it if you can share it with me.
    Regards,


    As a gesture of gratitude please consider rating helpful posts. c",)

    Some stuffs: Mouse Hotkey | Compress file using SQL Server! | WPF - Rounded Combobox | WPF - Notify Icon and Balloon | NetVerser - a WPF chatting system

  4. #4
    Frenzied Member
    Join Date
    Jul 2008
    Location
    Rep of Ireland
    Posts
    1,380

    Re: WPF tips and tricks on beautifying a form/control

    Unfortunatly styling is an art so you have to just try things and see how they flow. The videos in my sig have different individual concepts like mirroring and changing colors in listboxes but you will have to put all these together in a tasteful manner which can be hard to do.

  5. #5
    Pro Grammar chris128's Avatar
    Join Date
    Jun 2007
    Location
    England
    Posts
    7,604

    Re: WPF tips and tricks on beautifying a form/control

    One thing is for sure... you dont want to be taking advice from me on this subject
    My free .NET Windows API library (Version 2.2 Released 12/06/2011)

    Blog: cjwdev.wordpress.com
    Web: www.cjwdev.co.uk


  6. #6
    Frenzied Member
    Join Date
    Jul 2008
    Location
    Rep of Ireland
    Posts
    1,380

    Re: WPF tips and tricks on beautifying a form/control

    Lol, don't mind him!

  7. #7

    Thread Starter
    Software Carpenter dee-u's Avatar
    Join Date
    Feb 2005
    Location
    Pinas
    Posts
    11,127

    Re: WPF tips and tricks on beautifying a form/control

    Attach in my old winforms app, could you guys make suggestions on what things can I enhance by using WPF?
    Attached Images Attached Images  
    Regards,


    As a gesture of gratitude please consider rating helpful posts. c",)

    Some stuffs: Mouse Hotkey | Compress file using SQL Server! | WPF - Rounded Combobox | WPF - Notify Icon and Balloon | NetVerser - a WPF chatting system

  8. #8
    Frenzied Member
    Join Date
    Jul 2008
    Location
    Rep of Ireland
    Posts
    1,380

    Re: WPF tips and tricks on beautifying a form/control

    You could round out the text boxes and flatten down the buttons!

  9. #9

    Thread Starter
    Software Carpenter dee-u's Avatar
    Join Date
    Feb 2005
    Location
    Pinas
    Posts
    11,127

    Re: WPF tips and tricks on beautifying a form/control

    How do I do those? Just in the properties?
    Regards,


    As a gesture of gratitude please consider rating helpful posts. c",)

    Some stuffs: Mouse Hotkey | Compress file using SQL Server! | WPF - Rounded Combobox | WPF - Notify Icon and Balloon | NetVerser - a WPF chatting system

  10. #10
    Frenzied Member
    Join Date
    Jul 2008
    Location
    Rep of Ireland
    Posts
    1,380

    Re: WPF tips and tricks on beautifying a form/control

    No, you would have to rewrite the controls styles, chris has had a lot of experience with styles so he should be able to help you out!

  11. #11
    PowerPoster 2.0 Negative0's Avatar
    Join Date
    Jun 2000
    Location
    Southeastern MI
    Posts
    4,367

    Re: WPF tips and tricks on beautifying a form/control

    Also, look into Expression Blend. It is a visual tool that lets you apply nice styles to things. A lot of the time I use it to generate the XAML then I modify the xaml a little bit to tweak it.

  12. #12
    Pro Grammar chris128's Avatar
    Join Date
    Jun 2007
    Location
    England
    Posts
    7,604

    Re: WPF tips and tricks on beautifying a form/control

    Quote Originally Posted by DeanMc
    No, you would have to rewrite the controls styles, chris has had a lot of experience with styles so he should be able to help you out!
    I wouldnt say A LOT of experience with styles :P but I've played with them a little yeah. I'm sure it was you that showed me how to do the corner rounding thing anyway lol

    Like Negative0 said, Expression Blend is the easiest and fastest way to make nice looking UIs and thats what I used for rounding corners but that was just a rectangle I was rounding, I dont think the same method works for textboxes. I was setting the RadiusX and RadiusY properties but it seems textboxs dont have these properties.
    There do seem to be various ways to do this though, such as: http://chriscavanagh.wordpress.com/2...-for-anything/
    and
    http://wpfblog.info/2008/05/26/how-to-round-a-textbox/
    My free .NET Windows API library (Version 2.2 Released 12/06/2011)

    Blog: cjwdev.wordpress.com
    Web: www.cjwdev.co.uk


  13. #13
    Frenzied Member vbNeo's Avatar
    Join Date
    May 2002
    Location
    Jutland, Denmark
    Posts
    1,994

    Re: WPF tips and tricks on beautifying a form/control

    I've done a lot of styling with XAML as well... I can post some screenshots for you tommorow when I meet at work.

    Personally I don't like Blend. It's just like any other wysiwyg editor, though it might look good, the markup isn't exactly clean. I prefer writing it myself, and once you get the hang of it - it doesn't take that long.
    "Lies, sanctions, and cruise missiles have never created a free and just society. Only everyday people can do that."
    - Zack de la Rocha


    Hear me roar.

  14. #14

    Thread Starter
    Software Carpenter dee-u's Avatar
    Join Date
    Feb 2005
    Location
    Pinas
    Posts
    11,127

    Re: WPF tips and tricks on beautifying a form/control

    Thanks a lot guys. Keep them coming, once done I will probably upload the project in the codebank for everyone else to tear apart.
    Regards,


    As a gesture of gratitude please consider rating helpful posts. c",)

    Some stuffs: Mouse Hotkey | Compress file using SQL Server! | WPF - Rounded Combobox | WPF - Notify Icon and Balloon | NetVerser - a WPF chatting system

  15. #15
    Pro Grammar chris128's Avatar
    Join Date
    Jun 2007
    Location
    England
    Posts
    7,604

    Re: WPF tips and tricks on beautifying a form/control

    The main thing I find Blend useful for is creating things like gradients or animations as they are both a bit of a pain in the ass through manual XAML code
    My free .NET Windows API library (Version 2.2 Released 12/06/2011)

    Blog: cjwdev.wordpress.com
    Web: www.cjwdev.co.uk


  16. #16
    Frenzied Member vbNeo's Avatar
    Join Date
    May 2002
    Location
    Jutland, Denmark
    Posts
    1,994

    Re: WPF tips and tricks on beautifying a form/control

    Quote Originally Posted by chris128
    The main thing I find Blend useful for is creating things like gradients or animations as they are both a bit of a pain in the ass through manual XAML code
    I disagree .
    "Lies, sanctions, and cruise missiles have never created a free and just society. Only everyday people can do that."
    - Zack de la Rocha


    Hear me roar.

  17. #17
    Pro Grammar chris128's Avatar
    Join Date
    Jun 2007
    Location
    England
    Posts
    7,604

    Re: WPF tips and tricks on beautifying a form/control

    but how on earth do you figure out that to make a dark blue to light blue gradient you need to do this:
    xml Code:
    1. <Window.Background>
    2.         <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
    3.             <GradientStop Color="#FF37506B" Offset="0"/>
    4.             <GradientStop Color="#FF132238" Offset="1"/>
    5.         </LinearGradientBrush>
    6.     </Window.Background>
    My free .NET Windows API library (Version 2.2 Released 12/06/2011)

    Blog: cjwdev.wordpress.com
    Web: www.cjwdev.co.uk


  18. #18
    Frenzied Member vbNeo's Avatar
    Join Date
    May 2002
    Location
    Jutland, Denmark
    Posts
    1,994

    Re: WPF tips and tricks on beautifying a form/control

    Quote Originally Posted by chris128
    but how on earth do you figure out that to make a dark blue to light blue gradient you need to do this:
    xml Code:
    1. <Window.Background>
    2.         <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
    3.             <GradientStop Color="#FF37506B" Offset=""/>
    4.             <GradientStop Color="#FF132238" Offset="1"/>
    5.         </LinearGradientBrush>
    6.     </Window.Background>
    It's pretty obvious? I can see from your start- and endpoint you're making a top-down one. If you'd want to add a black middle segment you'd just add another gradientstop to the collection:

    xml Code:
    1. <Window.Resources>
    2.  <Color x:Key="Gradient_Blue_0">#FF37506B</Color>
    3.  <Color x:Key="Gradient_Blue_1">#FF132238</Color>
    4. </Window.Resources>
    5. <Window.Background>
    6.         <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
    7.             <GradientStop Color="{StaticResource Gradient_Blue_0}" Offset="0"/>
    8.                         <GradientStop Color="Black" Offset="0.5"/>
    9.             <GradientStop Color="{StaticResource Gradient_Blue_1}" Offset="1"/>
    10.         </LinearGradientBrush>
    11.     </Window.Background>

    as you can see I'm also all about reusing resources .
    "Lies, sanctions, and cruise missiles have never created a free and just society. Only everyday people can do that."
    - Zack de la Rocha


    Hear me roar.

  19. #19
    Frenzied Member
    Join Date
    Jul 2008
    Location
    Rep of Ireland
    Posts
    1,380

    Re: WPF tips and tricks on beautifying a form/control

    Swit Swoo, nice code. Ok im pushing work on my Xaml Highlighter, should be ready for the weekend!

  20. #20
    Pro Grammar chris128's Avatar
    Join Date
    Jun 2007
    Location
    England
    Posts
    7,604

    Re: WPF tips and tricks on beautifying a form/control

    I'm looking forward to some BETA testage
    My free .NET Windows API library (Version 2.2 Released 12/06/2011)

    Blog: cjwdev.wordpress.com
    Web: www.cjwdev.co.uk


  21. #21
    Frenzied Member vbNeo's Avatar
    Join Date
    May 2002
    Location
    Jutland, Denmark
    Posts
    1,994

    Re: WPF tips and tricks on beautifying a form/control

    For the screenshot I promised before, take a look at this thread:

    http://www.vbforums.com/showthread.p...=1#post3442686
    "Lies, sanctions, and cruise missiles have never created a free and just society. Only everyday people can do that."
    - Zack de la Rocha


    Hear me roar.

  22. #22
    Pro Grammar chris128's Avatar
    Join Date
    Jun 2007
    Location
    England
    Posts
    7,604

    Re: WPF tips and tricks on beautifying a form/control

    That looks really good
    My free .NET Windows API library (Version 2.2 Released 12/06/2011)

    Blog: cjwdev.wordpress.com
    Web: www.cjwdev.co.uk


  23. #23

    Thread Starter
    Software Carpenter dee-u's Avatar
    Join Date
    Feb 2005
    Location
    Pinas
    Posts
    11,127

    Re: WPF tips and tricks on beautifying a form/control

    After some busy months I may be able to give time to this endeavour again. Now, I just wish to ask how could I round those textboxes and flatten the buttons?

    I looked at the links but I am not sure where to place those snippets.

    TIA
    Regards,


    As a gesture of gratitude please consider rating helpful posts. c",)

    Some stuffs: Mouse Hotkey | Compress file using SQL Server! | WPF - Rounded Combobox | WPF - Notify Icon and Balloon | NetVerser - a WPF chatting system

  24. #24

    Thread Starter
    Software Carpenter dee-u's Avatar
    Join Date
    Feb 2005
    Location
    Pinas
    Posts
    11,127

    Re: WPF tips and tricks on beautifying a form/control

    After some searching I made some progress but it is not yet perfect, I am just showing the screenshot to get some feedbacks.

    The things I need to do is to beautify the groupbox, make the combobox look like the buttons, round out the listbox and some other things you suggest I should change.

    Here is the code that I used to design the buttons and also used with the combobox, problem is the dropdown button arrow is not show, how do I make it show?

    Code:
    <ControlTemplate x:Key="ComboBoxTemplate" TargetType="{x:Type ComboBox}">
            <Grid>
                <Rectangle Stroke="#FFe1e1e1" RadiusX="10" RadiusY="10" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Width="Auto" Height="Auto" x:Name="Rectangle">
                    <Rectangle.BitmapEffect>
                        <DropShadowBitmapEffect ShadowDepth="2"/>
                    </Rectangle.BitmapEffect>
                    <Rectangle.Fill>
                        <LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
                            <GradientStop Color="#FFF9F9F9" Offset="0"/>
                            <GradientStop Color="#FFd9d9d9" Offset="1"/>
                        </LinearGradientBrush>
                    </Rectangle.Fill>
                </Rectangle>
                <Rectangle Stroke="{x:Null}" Margin="3,14,3,3" RadiusX="14" RadiusY="10" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Width="Auto" Height="Auto">
                    <Rectangle.Fill>
                        <LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
                            <GradientStop Color="Transparent" Offset="0"/>
                            <GradientStop Color="Transparent" Offset="0.2"/>
                            <GradientStop Color="Transparent" Offset="1"/>
                        </LinearGradientBrush>
                    </Rectangle.Fill>
                    <Rectangle.BitmapEffect>
                        <BlurBitmapEffect Radius="1" KernelType="Box"/>
                    </Rectangle.BitmapEffect>
                </Rectangle>
            </Grid>
    
        </ControlTemplate>
    Attached Images Attached Images  
    Last edited by dee-u; Oct 13th, 2009 at 05:45 PM.
    Regards,


    As a gesture of gratitude please consider rating helpful posts. c",)

    Some stuffs: Mouse Hotkey | Compress file using SQL Server! | WPF - Rounded Combobox | WPF - Notify Icon and Balloon | NetVerser - a WPF chatting system

  25. #25
    Frenzied Member
    Join Date
    Jul 2008
    Location
    Rep of Ireland
    Posts
    1,380

    Re: WPF tips and tricks on beautifying a form/control

    I like it so far, clean yet modern, I wouldn't do to much for to it bar the small changes you have listed, other than that very professional and a fine example of restrained with WPF.

  26. #26

    Thread Starter
    Software Carpenter dee-u's Avatar
    Join Date
    Feb 2005
    Location
    Pinas
    Posts
    11,127

    Re: WPF tips and tricks on beautifying a form/control

    I edited my previous post and asked for help with regard to the combobox, can you help me with that?
    Regards,


    As a gesture of gratitude please consider rating helpful posts. c",)

    Some stuffs: Mouse Hotkey | Compress file using SQL Server! | WPF - Rounded Combobox | WPF - Notify Icon and Balloon | NetVerser - a WPF chatting system

  27. #27
    Pro Grammar chris128's Avatar
    Join Date
    Jun 2007
    Location
    England
    Posts
    7,604

    Re: WPF tips and tricks on beautifying a form/control

    You have started a new thread for it now so lets leave this one and concentrate on the new one (http://www.vbforums.com/showthread.php?p=3630551). I like the look of the app so far by the way
    My free .NET Windows API library (Version 2.2 Released 12/06/2011)

    Blog: cjwdev.wordpress.com
    Web: www.cjwdev.co.uk


  28. #28

    Thread Starter
    Software Carpenter dee-u's Avatar
    Join Date
    Feb 2005
    Location
    Pinas
    Posts
    11,127

    Re: WPF tips and tricks on beautifying a form/control

    Here is the new version with the minor tweaks I mention. Upon further testing I will release the code for everyone to whack.
    Attached Images Attached Images  
    Regards,


    As a gesture of gratitude please consider rating helpful posts. c",)

    Some stuffs: Mouse Hotkey | Compress file using SQL Server! | WPF - Rounded Combobox | WPF - Notify Icon and Balloon | NetVerser - a WPF chatting system

  29. #29

    Thread Starter
    Software Carpenter dee-u's Avatar
    Join Date
    Feb 2005
    Location
    Pinas
    Posts
    11,127

    Re: WPF tips and tricks on beautifying a form/control

    Here is the code for everyone to whack upon.
    Regards,


    As a gesture of gratitude please consider rating helpful posts. c",)

    Some stuffs: Mouse Hotkey | Compress file using SQL Server! | WPF - Rounded Combobox | WPF - Notify Icon and Balloon | NetVerser - a WPF chatting system

  30. #30
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: WPF tips and tricks on beautifying a form/control

    Looks great DU!
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  31. #31

    Thread Starter
    Software Carpenter dee-u's Avatar
    Join Date
    Feb 2005
    Location
    Pinas
    Posts
    11,127

    Re: WPF tips and tricks on beautifying a form/control

    Thanks Rob!
    Regards,


    As a gesture of gratitude please consider rating helpful posts. c",)

    Some stuffs: Mouse Hotkey | Compress file using SQL Server! | WPF - Rounded Combobox | WPF - Notify Icon and Balloon | NetVerser - a WPF chatting system

  32. #32
    Pro Grammar chris128's Avatar
    Join Date
    Jun 2007
    Location
    England
    Posts
    7,604

    Re: WPF tips and tricks on beautifying a form/control

    You could post any further screenshots in here: http://www.vbforums.com/showthread.php?t=559305 that thread could do with a bump :P
    My free .NET Windows API library (Version 2.2 Released 12/06/2011)

    Blog: cjwdev.wordpress.com
    Web: www.cjwdev.co.uk


  33. #33

    Thread Starter
    Software Carpenter dee-u's Avatar
    Join Date
    Feb 2005
    Location
    Pinas
    Posts
    11,127

    Re: WPF tips and tricks on beautifying a form/control

    Actually it is just a single window so there is no further screenshot. I may change the Help About which uses a messagebox and to improve the messagebox by using a custom one.
    Regards,


    As a gesture of gratitude please consider rating helpful posts. c",)

    Some stuffs: Mouse Hotkey | Compress file using SQL Server! | WPF - Rounded Combobox | WPF - Notify Icon and Balloon | NetVerser - a WPF chatting system

Posting Permissions

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



Click Here to Expand Forum to Full Width