fbpx
Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1

TOPIC:

Understanding WPF 21 Jul 2021 14:44 #19130

  • Terry


  • Posts: 251
  • I am aware that some here are trying to get to grips with WPF. It allows unparalleled flexibility and capability when designing a UI screen.

    It may initially appear difficult to understand.

    I have attached a short pdf which, hopefully, will help some.

    If I have made any stupid mistakes I would be grateful if you would let me know.

    Terry

    Please Log in or Create an account to join the conversation.

    Understanding WPF 21 Jul 2021 15:07 #19131

    • wriedmann
    • wriedmann's Avatar


  • Posts: 2685
  • Hi Terry,
    one of the most important things when designing WPF windows and controls is that not only containers can contain other containers, but also controls like buttons can host containers - so you can put a Grid or a StackPanel to a button or also in a ListView item, if you like.
    This window

    uses a Grid, and in one of the cells a StackPanel. The single controls of the StackPanel are all Pushbuttons (to react to key and mouse button press), and every pushbutton hosts a Grid that contains an Image and a TextBlock - and all that is entirely datadriven, using MVVM.
    That opens up an entire new world of GUI design.
    Wolfgang
    Wolfgang Riedmann
    Meran, South Tyrol, Italy

    www.riedmann.it - docs.xsharp.it
    Attachments:

    Please Log in or Create an account to join the conversation.

    Understanding WPF 21 Jul 2021 16:25 #19133

    • Terry


  • Posts: 251
  • Hi Wolfgang

    Yes I agree. Perhaps that should be added to the pdf.

    But the Question I would ask is how far do you go for someone who is totally new to WPF.

    Button content is an Object can indeed host any other Object such as a Container which is also an object.

    My thinking was if we get into that chain (MVVM etc) it cold become too overwhelming too soon.

    But it's certainly worth mentioning, as you have done, at this stage.

    What do you think?


    Terry

    Please Log in or Create an account to join the conversation.

    Understanding WPF 21 Jul 2021 16:28 #19134

    • wriedmann
    • wriedmann's Avatar


  • Posts: 2685
  • Hi Terry,
    even if WPF works better when used with the MVVM paradigm, that goes far beyond someone new to WPF can understand.
    I would add that WPF add a lot of graphical possibilities, and makes it really, really easy to build own controls that are only a composition of other basic controls.
    Wolfgang
    Wolfgang Riedmann
    Meran, South Tyrol, Italy

    www.riedmann.it - docs.xsharp.it

    Please Log in or Create an account to join the conversation.

    Understanding WPF 21 Jul 2021 16:30 #19135

    • FFF


  • Posts: 1162
  • It would habe been easier, if they had choosen a clearer wording.
    - "Everything" is a "control"
    - controls can contain controls
    - controls have properties and capabilities to act and react.
    Did i miss something ;-?
    Regards
    Karl (X# 2.7; Xide 1.27; W8.1/64 German)

    Please Log in or Create an account to join the conversation.

    Understanding WPF 21 Jul 2021 17:52 #19136

    • Terry


  • Posts: 251
  • Hi Karl

    You write: Did i miss something ;-?

    I don't know. But Everything is an Object. Controls are Objects.

    - cobjects can contain objects.
    - objects have properties and capabilities to act and react.

    More or less what you said and principles of OOP.

    Clearer wording? I'd probably agree in this context. But we all think differently and maybe clearer wording to me would not be clearer wording to you.

    Regards

    Terry

    Please Log in or Create an account to join the conversation.

    Understanding WPF 21 Jul 2021 20:09 #19138

    • ic2


  • Posts: 1018
  • Hello Terry, Karl, Wolfgang,

    There is a lot you can do based on much WPF XAML and not even so much "code behind". I recommend to check out these programs to be amazed. Even though these are old, they still work, for the 2nd you may need to remove the Signing certificate and agree to a higher .Net version.

    Horse Race:

    www.codeproject.com/Articles/18232/A-Gui...r-of-WPF-Part-1-XAML

    Baby Smash:

    www.hanselman.com/blog/introducing-babysmash-a-wpf-experiment


    This having said, it is often difficult to predict what happens on viewing your screens when content is added in stackpanels or dockpanels. On the other hand, you can still design a screen much the way you did in VO and also enter a value without MVVM/databinding, by directly addressing the name of the control, so also just like in VO

    Dick

    Please Log in or Create an account to join the conversation.

    Last edit: by ic2.

    Understanding WPF 22 Jul 2021 10:50 #19141

    • Terry


  • Posts: 251
  • Hi Dick

    Yes I agree amazing things can be done using Xaml.

    But learning it takes time that could be spent learning something else.

    It was just my personal opinion that it was quicker to progress up the learning curve by following a "quick coding route". with Xaml coming later.

    Xaml first may prove quicker for some. As with anything else in programming it is all trade-offs. Nothing is real;y black or white.

    Regards

    Terry

    Please Log in or Create an account to join the conversation.

    • Page:
    • 1