WPF Custom User Control + Dependency Properties

Sdílet
Vložit
  • čas přidán 26. 07. 2024
  • In this video we create a simple custom user control which acts as a spoiler button for displaying and collapsing content behind it. We also vaguely cover using dependency properties and how to implement our new custom control.
    Button Style Code: pastebin.com/TqdABJKf
    MainWindow.xaml: pastebin.com/M8tKwxUP
    SpoilerControl.xaml: pastebin.com/H1JmChAH
    SpoilerControl.cs: pastebin.com/YwtGVhEh
    More Info: docs.microsoft.com/en-us/dotn...
    ** Tip Jar **
    Paypal: toskerscorner@outlook.com
    BTC: 3DkvwvcQ8Vt2U84jdtEhNBx2Ueai3Xttmu
    ETH: 0xFf79A145e1ED6F538607Ec374968e605cbea758b
    BCH: qqpgrnzuhc5hav4e79m8nfhmugs46jtl0ujxcu0tj5
    LTC: MHXQmJA3hkwTPeArB9QPNkcLiHQx723yMb

Komentáře • 36

  • @ToskersCorner
    @ToskersCorner  Před 5 lety +5

    Full Source Code: github.com/Tosker/ContactBook-Tutorial

  • @shvideo1
    @shvideo1 Před měsícem

    Great tutorial with a very practical example. Great job. Thank you.

  • @myx555
    @myx555 Před 3 lety +1

    3:19 - Says "But" and types "

  • @longuinni
    @longuinni Před 6 lety

    Great video!!! Really easy to understand.

  • @BarnsWills
    @BarnsWills Před 3 lety

    Saved me loads of time! Cheers!

  • @d4rkw34v3r
    @d4rkw34v3r Před 6 lety

    Awesome video! Thank you very much.

  • @solvedplus858
    @solvedplus858 Před 4 lety

    this is very good and simple
    many thanks for your greet tutorial

  • @stratman1234
    @stratman1234 Před 4 lety

    This is very helpful. I didn't know about setting the Name property of the UserControl and the using the ElementName to get the property. Great job!!

  • @valnuke
    @valnuke Před 5 lety

    excellent video

  • @ChantingInTheDark
    @ChantingInTheDark Před 2 lety +1

    Thanks, this helped, I had everything right on my own except this one part: ElementName= when binding the property to the user control's XAML. I'm curious what the other methods were you mentioned.

  • @jackzhang8097
    @jackzhang8097 Před 4 lety +4

    When I bind the ViewModel property to the dependency property of the custom UserControl, the UI interface is not updated after the data is updated. Do you know why?

  • @shameerminhas9152
    @shameerminhas9152 Před rokem

    Genius

  • @moppetskitzo9521
    @moppetskitzo9521 Před 5 lety +2

    in description SpoilerControl.cs link follows to same XAML code as SpoilerControl.xaml

    • @ToskersCorner
      @ToskersCorner  Před 5 lety

      Sorry about that. Full source code is available here: github.com/Tosker/ContactBook-Tutorial

  • @KD-xp4di
    @KD-xp4di Před 5 lety

    Hehehe thank you for the warning

  • @fooballers7883
    @fooballers7883 Před 10 měsíci

    thanks...much appreciated.

  • @hishoegypt1980
    @hishoegypt1980 Před rokem

    Q: how to make a style in the main window for the new usercontrol and the style contain the dependency properties of the usercontrol?

  • @kumarharsh8931
    @kumarharsh8931 Před 5 lety

    is it possible to create Custom usercontrol with mvvm where we should not have Dp in code behind rather in viewModel?

    • @shaihulud4515
      @shaihulud4515 Před 5 lety

      Actually you can, by using XAML. It's called control.template. So, e.g. create a radiobutton-style, create a control.template tag and throw in a togglebutton for instance. Voila.

  • @ImDeesu
    @ImDeesu Před 6 lety +1

    What is the difference between TargetType="Button" and TargetType="{x:Type Button}"?

  • @francoisdeklerk1266
    @francoisdeklerk1266 Před 6 lety

    Audio?

    • @ToskersCorner
      @ToskersCorner  Před 6 lety

      There is audio, perhaps it is quiet for you? Seems fine for me.

    • @francoisdeklerk1266
      @francoisdeklerk1266 Před 6 lety

      Appreciate your videos, man!! Yes, the audio seems to very quite

    • @ToskersCorner
      @ToskersCorner  Před 6 lety

      Thanks! And sorry to hear that. Perhaps a pair of head phones or checking your settings might help.

    • @francoisdeklerk1266
      @francoisdeklerk1266 Před 6 lety

      Thank you very much for your tutorials. I think you deserve more views than what your'e getting

    • @levelheaded6214
      @levelheaded6214 Před 4 lety

      @@ToskersCorner I had to CRANK the volume way up as well. Good vid.

  • @AndrewVaderUKS
    @AndrewVaderUKS Před 5 lety

    in description SpoilerControl.cs link follows to same XAML code as SpoilerControl.xaml

    • @ToskersCorner
      @ToskersCorner  Před 5 lety

      Sorry about that. Full source code is available here: github.com/Tosker/ContactBook-Tutorial