Dropdown - WPF UI COMPONENT WORKSHOP

Поделиться
HTML-код
  • Опубликовано: 14 дек 2024

Комментарии • 29

  • @CodeBoyyy
    @CodeBoyyy 11 месяцев назад

    This tutorial is insane, Not only for that little drop down menu, But for the content and the hole guide of doing things, Thank you so much..

  • @KiII4Game
    @KiII4Game 7 месяцев назад +1

    This tutorial is awesome, but i found one small unintended behavior and a fix for it:
    When using the checkbox to open a popup window, if you click off of the popup window and want to reopen it, you have to click the dots twice to open it again. This is because you are effectively "unchecking" and "rechecking" the checkbox.
    My fix for this is to change the checkbox tag to a toggle button:
    and then change the Popup's IsOpen property to:
    IsOpen="{Binding IsChecked, ElementName=tripleDots}"
    this now functions the same way but without the double clicking bug as this doesnt depend on the state of a checkbox, but rather by opening the popup window if the dots were clicked at all. this also has the added side effect of making the togglebutton tag cleaner than the checkbox tag by getting rid of the WPF state control code :)

    • @Oleg87arh
      @Oleg87arh 3 месяца назад

      Thanks for your solution! It helped me a lot. Do you know also how to prevent the background from scrolling while the popup is open?

  • @windowsbuilderthegreat3121
    @windowsbuilderthegreat3121 2 года назад +4

    Please could you do a tutorial series on styling controls like buttons, progress bars, radio buttons, drop down lists, combo boxes, text boxes, etc

  • @8-P
    @8-P 2 года назад

    I've been waiting for this one for years :-)
    Thank you very much!

    • @SingletonSean
      @SingletonSean  2 года назад +1

      Woohoo, thanks for waiting Serthy! Hope this turned out to be helpful too

  • @williamliu8985
    @williamliu8985 2 года назад +1

    Yeah... WPF need more love~

  • @meddler55
    @meddler55 Год назад

    Thanks for the great video! Where did you learn everything you know about WPF / Xaml?

    • @SingletonSean
      @SingletonSean  Год назад +1

      Hey Meddler, good question! I mostly learned on the job and through experience. My first engineering job was WPF-focused, so I was writing WPF every single day. I'd constantly run into issues or knowledge gaps (as expected with WPF) and research through the Microsoft Documentation, Google, Stack Overflow, etc...
      This has really been my method for learning anything! Build -> Run into something you don't know -> Learn it -> Use your new knowledge -> Repeat

  • @lucabonini2233
    @lucabonini2233 2 года назад

    Awesome content as always

  • @crackedboy701
    @crackedboy701 Год назад

    How can I change the color of the 3 dots? specifically I want to change them to color white for my dark theme background

  • @ivandrofly
    @ivandrofly 2 года назад

    5:30 TemplateBinding / TemplateParent
    8:06 clicking between space in triple dots issue

  • @timjones3128
    @timjones3128 Год назад

    Sean, I've watched several of your videos and would love to know what you use to have the properties auto align. For example @ timestamp 11:30 when you are setting the color animation, you complete setting the Storyboard.TargetProperty and then all of the ColorAnimation properties indent align automatically. How do you do that?

    • @SingletonSean
      @SingletonSean  Год назад

      Hi Tim! That is done via the tool described here: ruclips.net/user/shortsFVO5HhUotHE?feature=share

  • @TheAlbinoZombie
    @TheAlbinoZombie Год назад

    Hey I'm just seeing this channel and tutorial and it's awesome! I really appreciate it. Hopefully this video isn't too old for me to ask a question about.
    I was wondering if you could tell me how to close the popup window once a button inside of it is selected? In your case, if you click "Edit" or "Delete", how do you get the popup window to close? Clicking outside of the window works just as you have in the video but my popup stays open if I click one of the buttons inside.

  • @JarosawPietras
    @JarosawPietras Год назад

    How use this Conrtrol to creat SplitButton?

  • @ZANES-YT
    @ZANES-YT 2 года назад

    How would you do that kind styling etc. in a context menu? Btw ur timing couldn't be better currently working on a larger more advanced wpf app as my college/school project hyped because I used all your best practises since I learned it last year thanks for that, and one more thing as a video suggestion advanced wpf and singalR usage with sending attachments like files or images or audio would be quite interesting 👍

  • @MsQlan
    @MsQlan 3 года назад

    Hi Sean, thanks for another excellent guide as per usual. This is exactly what I needed for a project I'm working on. I did however come across an issue that I'm unsure how to solve, might be that I've missed something in the code.
    The IsOpen boolean is set to false when the popup is automatically closed.
    However this is not replicated to the checkbox IsChecked boolean because as you stated in the video, TemplateBinding is a OneWay binding.
    So if you click the checkbox to trigger the popup and then click somewhere else it automatically closes, which is great. But since the checkbox is still checked it now takes two clicks to display the popup menu again.
    I tried replacing the TemplateBinding of the popup IsOpen property with the same TwoWay implementation as the checkbox which solves the above issue.
    However now I can't untoggle the popup by clicking the checkbox directly. It vanishes and then gets displayed again directly afterwards.

    • @SingletonSean
      @SingletonSean  3 года назад +1

      Good catch MsQlan! That was difficult, but somehow I fixed it hahaha: github.com/SingletonSean/wpf-ui-workshops/commit/311e73d00a0a06d188a42977ece3502cec2c55ca
      When the popup closes and the mouse IS NOT over the toggle check box, then we set IsOpen to false. This "unchecks" the checkbox, so next time we click it, the dropdown opens immediately.
      When the popup closes and the mouse IS over the toggle check box, then we do nothing. The checkbox ends up "unchecking" itself since we're clicking it.

    • @MsQlan
      @MsQlan 3 года назад

      @@SingletonSean Awesome stuff! Works like a charm. Thank you so much.

  • @muhammadsaadat5979
    @muhammadsaadat5979 2 года назад

    Hi Singleton Sean. I Keep follow your tutorials and I must say it really help me alot in my work place as well as my daily routine coding. I have a request Can you please make tutorial on Custom Control Combobox which contain items with respective headers. Like GridView Columns with Headers. Thanks in Advance

  • @timjones3128
    @timjones3128 Год назад

    Hi Sean, I love the custom drop down control. I have been playing around with it, and I have run into a question. This works great if the image you are using is the same for each line. How would you Bind to an attached property that passes a different image?
    For example two list boxes in the same user control. One would use the three horizontal dots and the other would use, say a mahapps Icon from an iconpack?

    • @timjones3128
      @timjones3128 Год назад

      You would have to create a dependency property in DropdownMenu.cs.
      public static readonly DependencyProperty IconImageProperty =
      DependencyProperty.Register("IconImage",
      typeof(ImageSource),
      typeof(DropdownMenu),
      new PropertyMetadata(0));
      public ImageSource IconImage
      {
      get => (ImageSource)GetValue(IconImageProperty);
      set => SetValue(IconImageProperty, value);
      }
      Then in Generic.xaml you would change the control template to something like this.














      Then in xaml you would use
      xmlns:iconPacks="metro.mahapps.com/winfx/xaml/iconpacks"
      xmlns:local="clr-namespace:DropdownMenuControl;assembly=DropdownMenu"
      This will allow you to set any Image Source you like. Hopefully this helps.

  • @ClanLosFriendsGamer
    @ClanLosFriendsGamer 3 года назад

    Hi Sean, how can I create a dynamic dropdown menu where the content is bound to e.g. a variable? As an example from this video here, that the Edit becomes an Add or that another menu item is dynamically added to the dropdown menu. As an addition, of course, would be perfect if all this is also bound to controls (views). Greetings from Germany

    • @SingletonSean
      @SingletonSean  3 года назад +1

      Hey Freelancer RG, that's a good question! The contents of the DropDownMenu control can bind to whatever the view's DataContext is. For example, in this application, I bind to Commands on my view model:
      github.com/SingletonSean/youtube-viewers/blob/master/RUclipsViewers.WPF/Components/RUclipsViewersListingItem.xaml#L118
      Based on your description, I think you're looking for something more advanced. Let's suppose the DataContext for your DropDownMenu is "SomeItemViewModel".
      SomeItemViewModel could have an ObservableCollection of... okay nvm, I should just demo this. Here's a changeset with this functionality!: github.com/SingletonSean/wpf-ui-workshops/commit/9e0230e5f0244ef6844495827ea662262c4a93c8

    • @ClanLosFriendsGamer
      @ClanLosFriendsGamer 3 года назад

      @@SingletonSean Thanks, I will try this and give you feedback.

  • @BloodHaZaRd666
    @BloodHaZaRd666 2 года назад

    amazing ;)

  • @TbIPDblM
    @TbIPDblM Год назад

    It's top -)