Це відео не доступне.
Перепрошуємо.

ItemsControl (the "for loop" of XAML) - WPF TUTORIALS

Поділитися
Вставка
  • Опубліковано 15 сер 2024
  • Learn how to use the WPF ItemsControl in order to beautifully display a collection of items. The ItemsControl component is basically the "for loop" of XAML and allows more customization than other collection components (ex: ListView and ListBox).
    🕗 Timestamps:
    0:00 - Introduction
    0:15 - Demo Introduction
    1:20 - Adding the ItemsControl
    2:06 - Defining an ItemTemplate
    4:44 - Overriding the ItemsPanel
    5:36 - UI Cleanup
    6:42 - Adding More Items
    7:41 - Supporting Scrolling
    8:17 - Extracting the ItemTemplate to a Component
    8:57 - Summary
    📦 Source code: github.com/Sin...
    🔁 Full playlist: • WPF Tutorials
    🔗 Property changed snippet (propchange): singletonsean....
    🎉 Celebrate the channel members: members.seando...
    💎 Become a member: / @singletonsean
    📝 Check out my blog: seandodson.com
    🏆 Donate: www.paypal.com...

КОМЕНТАРІ • 30

  • @aquadust
    @aquadust 2 місяці тому +1

    This was so clear and helpful! Thanks so much! :)

  • @emilfoger9655
    @emilfoger9655 Рік тому +1

    Where have you been all my life? Love this channel!

  • @drgothmania
    @drgothmania Рік тому +3

    Back to basics. I love your videos because they're very detailed and focused. Learnt a lot about MVVM and design patterns, which really transformed my programming practice. Thanks Sean.

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

      Glad this content and video style has been helpful for your learning, Long!

  • @patrickddd
    @patrickddd Рік тому +2

    I love the format of this video, short and very informative 👌

    • @SingletonSean
      @SingletonSean  Рік тому +1

      Thanks Patrick, and happy to hear that! I'm shooting to do more of this format in the future

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

    Thanks a lot! I've been searching a whole day and finally found this video which is exactly what I'm looking for. Hope you can get more popular and can be found easier by searching in the future 😄

  • @brominhussain7148
    @brominhussain7148 Рік тому +1

    Thank you Sean for these awesome wpf contents. Your videos helped me with lot of things during my initial year as a developer.

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

      That's awesome to hear, glad these have been helpful bromin!

  • @Supernewsfan
    @Supernewsfan Рік тому +1

    Such a rich UI framework even though it is very old

  • @Studse_
    @Studse_ Рік тому +3

    Hi Sean, cool video.
    Can you make a video, where the itemscontrol have buttons? - Where all buttons do something individually.

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

      Looks like it's gonna be related to Commands. The simplest example I can come up with is a toolbar.

    • @SingletonSean
      @SingletonSean  Рік тому +1

      Thanks Studse! As Long suggested, we would need to add a Command property on each of our list view item view models (such as the ProductViewModel in this demo). If you prefer code-behind click handlers instead of commands, you could extract the DataTemplate contents into another UserControl, which will have it's own code-behind scoped to each list view item. I'll try to find a more concrete example of this, good question!

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

    Hi Mr, thank u shared is a grear video

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

    Thank you!!!

  • @paulbarker5295
    @paulbarker5295 Рік тому +1

    Just started learning wpf - How easy would it be to paginate these cards and if you wanted to affect (change colour) an individual card would that be easy?

  • @obsidian741
    @obsidian741 Рік тому +1

    Hey Sean, I was thinking about the content near the end of the video where you move the code inside the data template to a usercontrol. For me, I would prefer to extract the data template as a resource because using a usercontrol seems a bit heavy. What do you think? Anyway, keep up the good work!

  • @SweatingLama
    @SweatingLama 10 місяців тому

    Hi, Sean! Thank you for your work, it's awesome! Can i ask you to make tutorial for treeview with HierarchicalDataTemplate, and show to us how to deal with it?

  • @mukkulnagpal
    @mukkulnagpal 2 місяці тому

    If ItemControl has suppose 10 items. I want to show left and right arrow instead of scrollbar so that user can click those arrows to navigate to different items itemcontrol. How to achieve this ?

  • @deadlyremix4115
    @deadlyremix4115 10 місяців тому

    may be a silly question, but is it possible to get the "i" in a for loop? like the number at which it is looped to. reason i ask is because i want to know the index of that control and then pass that to a shared command so I don't have to make a million separate commands

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

    I have used listviews in the same way, with it being a wrap panel - not just a list. But maybe I should change those to use the itemsControl.
    Some issues I have been having with this, is that with complex data templates and large collection, render times are huge. Opening my tab takes 4-5 seconds. Any chance of a video on how to improve rendering? Caching, virtualisingStackPanels etc?
    Thanks!

    • @SingletonSean
      @SingletonSean  Рік тому +2

      Ah very good question NC, I believe I've had issues with this in the past. This is another drawback of using an ItemsControl instead of the higher level collection controls. In fact, it correlates with the other drawback of ItemsControl in which it doesn't have a scroll viewer, which is a critical piece of virtualization!
      I ended up using a ListView w/ virtualization when I had this issue in the past, but it is possible to hook into WPFs virtualization mechanism from an ItemsControl. We'll need to roll it ourselves, but it's not too much overhead! I found this StackOverflow post helpful: stackoverflow.com/questions/2783845/virtualizing-an-itemscontrol

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

      @@SingletonSean Thanks for the reply! Very useful link - will see if that helps :)

  • @Elemblue2
    @Elemblue2 10 місяців тому

    I was subjected to two unskippable two minute advertisements at the start of the video.
    Time for an ad blocker.

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

    Hi Sean. Make a project out of it and replace all your old videos audio with this. ua-cam.com/video/2tUgFuCJdjk/v-deo.html
    Sorry for being invasive to your sleep thoughts : )

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

      Agreed

    • @SingletonSean
      @SingletonSean  Рік тому +2

      Agreed, I wish the audio were better on these older videos. Unlike most videos, this was recorded a long time ago and got lost. There might be a few more "classic" SingletonSean videos with the lower quality mic, but almost all videos moving forward will have the better mic!
      Although I should take your suggestion more seriously. That is a really good idea: a program that downloads the video from UA-cam (or takes in any video from anywhere), extracts the audio, runs the Audacity sound correction, replaces the audio, and then spits out a new video. Maybe something already exists but either way I will consider this, it would be fun and useful! So yes, you are invading my sleep thoughts now but I appreciate it 😂