Creating a Card Control - FULL STACK WPF (.NET CORE) MVVM #6

Поділитися
Вставка
  • Опубліковано 18 гру 2024

КОМЕНТАРІ • 34

  • @Dame4Lyf3
    @Dame4Lyf3 4 роки тому +3

    Great series, as just started following along, not sure if the Financial site changed, but needed to sign up and append the api key, just incase anyone else was having issues.
    Great stuff tho meaning to learn MVVM

    • @SingletonSean
      @SingletonSean  4 роки тому

      Hey Dame, thank you for pointing this out! I'll have to make a quick video on setting up an API key. You win the prize for pinned comment though, hahaha.

  • @kdowd161
    @kdowd161 7 місяців тому

    This is a really , really good vid - its not "mid" as the youth would say round my way....

  • @faraz-online
    @faraz-online 4 роки тому +1

    No doubt!!! A treasure for a learner! XAML is a deep sea for sure! While, at the same time you sure have proved to be an ideal Lifeguard!
    Thanks SS!!!

  • @LeslieLWilliams
    @LeslieLWilliams 3 роки тому +1

    Just want to say that I am glad that I checked out this tut. Excellent job. Thanks

  • @wesleykenis1870
    @wesleykenis1870 Рік тому

    I learn a lot from your videos, but I have a little trick for you and the other viewers too:
    if you add the following line to the declaration of your views/controls, you have support for type ahead also and this helps reduce the amount of "why is this not showing...oh I made a typo here" kind of errors. This also helps when renaming things since now these references can be found using e.g. Resharper
    d:DataContext="{d:DesignInstance Type=nav:Navigator, IsDesignTimeCreatable=False}"

  • @davidporterrealestate
    @davidporterrealestate 4 роки тому +3

    "like"ing every video in this series as I go through

  • @ameeradel4835
    @ameeradel4835 3 роки тому

    dude writes code, code works
    i copy his code, code works, its magic!

  • @davidvestal170
    @davidvestal170 Рік тому

    At 12:00 you right-align everything in the first row, with the effect that everything in the first _column_ becomes aligned. Wizardry...

  • @emaus8344
    @emaus8344 Рік тому

    Hi Sean, how would you go about adding cards on a view dynamically? Do you have any videos on that topic?

  • @thomasbarratt5333
    @thomasbarratt5333 3 роки тому

    Hi Sean, I've been meaning to follow this series for a long time now and finally got the time to chip away at it. Great work! It's very clearly presented. I've noticed the suffixes have changed for each market (Dow "^DJI", Nasdaq "^IXIC" and SP500 "%5EGSPC"). Also, i'm not sure you cover it in your video but WPF doesn't automatically render clear and sometimes we need to use the UseLayoutRounding="True" property on a UIElement.

  • @Saleca
    @Saleca 4 роки тому

    one thing could be useful is to use display key struck . I am wondering how you navigate the snippet, since when I was pressing tab on "myVar" it switched from "_nasdaq" to "majorIndex" and I see your intellisense also suggested that but didn't change. at the moment I am pressing up then tab to avoid this but gets annoying sometimes I don't notice the change. and once again great work.

  • @ms8367
    @ms8367 4 роки тому +3

    How did you learn WPF to this degree of proficiency? My mind is blown by how much you can do. I thought I was okay with WPF but I am learning so much from your videos.

    • @SingletonSean
      @SingletonSean  4 роки тому +8

      Hey MS204, it's all about practice and exploring. It also takes some questioning, such as "Is there a better way to do this? Is this extendable and maintainable?". I can guarantee that the first WPF program I wrote is nothing like what I write nowadays, haha. Another thing that has helped a TON is exploring front end JavaScript frameworks, such as React and Vue. I've learned a lot of principles from JS frameworks that I've been able to apply to WPF. Plus it's much easier to find learning resources in the JS ecosystem compared to WPF (sadly).

  • @wavyska
    @wavyska 2 роки тому

    Hi Sean. Usually you try to decouple the View and the code-behind implementation as much as possible. Here you make direct references to the ViewModel classes in the ConverterParameter of {Binding CurrentViewModel}. Would you think of a way to improve that?

  • @kamigo
    @kamigo 4 роки тому

    I think you should have adapted the code to be able to have an undefined number of major index
    But other than that, thank you for your great videos. They really are the best I have found for the moment, and I searched a lot about wpf.

  • @glebbannyy368
    @glebbannyy368 2 роки тому

    Hey Sean,
    Isn`t it better to write something like
    return value.GetType().FullName == parameter.ToString();
    Instead of
    return value.ToString() == parameter.ToString();
    In EqualValueToParameterConverter so that you will not bother whether or not the ToString Method is overridden?

  • @jcturpin8737
    @jcturpin8737 4 роки тому +1

    Hi, sorry if it feels like I'm blowing up your comments, I just like to share ideas I've found, have dialogue, and/or ask questions as I go through your tutorials, I hope I don't ever come across as critical, because I'm not. For the part where we need to convert a property to a full property, I paused before seeing you created a cool snippet for that feature. Then I found that you can highlight the property, ctrl+. it, and 'convert to full property'. It created a streamlined version:
    private MajorIndex dowJones;
    public MajorIndex DowJones { get => dowJones; set => dowJones = value; }
    I then selected the dowJones field, CtrlR+R to add the _ to it with a rename, and took the Lamda arrow away from the set and replaced it with curly brackets, so it could hold 2 statements, resulting in
    private MajorIndex _dowJones;
    public MajorIndex DowJones { get => _dowJones; set { _dowJones = value; OnPropertyChanged(nameof(DowJones)); } }
    I found I like the one liner for the get and set (as long as it doesn't get more complicated down the road), but it wasn't break point friendly.
    I found I could just hit enter before 'OnPropertyChanged()' to set a temporary breakpoint if needed though, then could put it back to the one-liner.
    I just thought I'd share my thoughts a bit on how to shrink up the property. I think it would be neat to have a snippet for that type of format. :-)

    • @SingletonSean
      @SingletonSean  4 роки тому +1

      Hey JC, that's not a bad idea. Those dang property changed properties do take up a lot of space, so it would be beneficial to make them one-liners. I usually don't need to place breakpoints in them anyways. I might edit my snippet, but in the meantime feel free to edit the downloadable one. It should be straight-forward to alter, just removing line breaks :)

    • @jcturpin8737
      @jcturpin8737 4 роки тому +1

      @@SingletonSean *I found a way to streamline these properties even more. Instead of passing in the name using nameof(), you can just do this:
      *In your ViewModel base class, update the method to use [CallerMemberName] like this:
      protected virtual void OnPropertyChanged([CallerMemberName]string propertyName = null)
      {
      PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
      }
      and use it like this:
      private string _symbol;
      public string Symbol { get => _symbol; set { _symbol = value; OnPropertyChanged(); } }
      *and for cases where you need to pass in a different name than the calling name, you can still do so, such as this:
      private double _stockPrice;
      public double StockPrice { get => _stockPrice; set { _stockPrice = value; OnPropertyChanged(); OnPropertyChanged(nameof(TotalPrice)); } }
      Just another way to do the same thing, lol, thought I'd share. :-)

  • @PeterSteele111
    @PeterSteele111 4 роки тому

    Great video series so far. I am having a bit of an issue though. When I try to load up the view model by default when starting the application, I get a stack overflow error. My App.xaml.cs is loading the main window, setting the data context to my MainViewModel, and then the navigator takes over. The navigator is instantiated and set in the MainViewModel like you have done, and in the constructor of the MainViewModel I call Navigator.UpdateViewModelCommand.Execute(ViewType.Home); as you have. When I set a breakpoint though inside of the UpdateCurrentViewModelCommand switch statement, it hits correctly as a Home Type, but that creates another view model for MainViewModel and circles back to the constructor of the MainViewModel again, and loops until I get a stackoverflow error. As far as I can tell, I have it setup like you, so I don't fully understanding what is going on here. Any insight if others might have run into this issue would be much appreciated! Thank you so much!

    • @PeterSteele111
      @PeterSteele111 4 роки тому

      NVM figured it out. I was trying to use the Main View Model as my home view model too still. I changed that to load the main view model first, and then set the Navigator to use the HomeViewModel instead and it loaded fine with circling back on itself over and over again. Thanks again for the great tutorials so far!

  • @ElCidPhysics90
    @ElCidPhysics90 3 роки тому

    So far this is an awesome series. Well done. Thanks, Sean.
    Question: How would you handle the card display if you didn't know the number of majorindexes? Say it was a different object you were putting in the card but you weren't sure how many of them you had. How would you handle adding that to the display?

    • @SingletonSean
      @SingletonSean  3 роки тому +2

      Hey ElCidPhysics, I have this issue quite frequently! The trick is to use an ItemsControl and define a custom ItemTemplate. I'm not sure I have an example of this, but I want to do a video on this. It's pretty much the equivalent of a doing a "for loop" in XAML.

    • @ElCidPhysics90
      @ElCidPhysics90 9 місяців тому

      @@SingletonSeanthank you. Sorry I didn’t see this earlier

  • @gajarubanjeyakumar7226
    @gajarubanjeyakumar7226 4 роки тому +1

    HI, Is it possible to make the cards update values realtime? like every sencond, while you are in Home view?

    • @SingletonSean
      @SingletonSean  4 роки тому +1

      Hey Gajaruban, that's a planned feature! To implement that, I plan to use a Timer that will ping our MajorIndexService and refresh the cards. It will be exciting.

    • @gajarubanjeyakumar7226
      @gajarubanjeyakumar7226 4 роки тому

      @@SingletonSean Nice. looking forward to that. I'm great full for all your videos. Thanks.

  • @sergiocamacho730
    @sergiocamacho730 4 роки тому

    Hey Sean,
    I´m following your tutorials and they are fantastic. I would like to ask you something. Are you currently using a MVVM framework for your projects?
    Cheers from México,
    Sergio Camacho

    • @SingletonSean
      @SingletonSean  4 роки тому +2

      Hey Sergio, currently I am not using an MVVM framework. I feel comfortable just using vanilla WPF. However, many people have asked about frameworks, so I might have to check one out! Glad to hear you're enjoying the tutorials.

    • @sergiocamacho730
      @sergiocamacho730 4 роки тому +1

      @@SingletonSean Thanks for the answer. That is great to hear. I think that the frameworks just complicate things and they are a little bit overwhelming to learn. The only nuget packages that I consider very useful is the ones called Fody and PropertyChanged.Fody. They take care of the full implementation of the properties in classes that implement the INotifyPropertyChanged.

  • @sometexthere4169
    @sometexthere4169 4 роки тому +1

    Thanks! I like it!

  • @feitan8745
    @feitan8745 5 років тому

    Anyways thanks for the content.