How to Switch Themes in a WPF App at Runtime

Поделиться
HTML-код
  • Опубликовано: 27 фев 2023
  • This video is a step-by-step tutorial on How to Switch Themes in a WPF App at Runtime, You will learn how to set up a Resource Dictionary to contain different themes, create styles and templates for your controls, and dynamically switch between themes at runtime.
    Source Code:
    github.com/TacticDevGit/Switc...
  • НаукаНаука

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

  • @liamlluls1588
    @liamlluls1588 Год назад +2

    Nice, good idea for part 2, store the user choice in settings.settings or something so they don’t have to change it to dark every time they boot the app

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

    Mate it's so good to watch you. Lots of these Videos are boring like hell, becuase U have to watch the guys preparing the UI with mistyping 1000 times. But this video is just amizing good, with well prepared content and easy explanation. You are a talented teacher Sir. Well done.

  • @user-kb8nd9tk1h
    @user-kb8nd9tk1h 2 месяца назад

    Thank you for this Video. this would have to be the most professionally explained WPF theme tutorial I have seen to date. Well explained and Included source code project. You are enjoyable to watch, listen to and Learn from.

  • @ThomasSchmidt-Esterle
    @ThomasSchmidt-Esterle 10 месяцев назад

    Very clean and straight forward. **ThumbsUp**

  • @niangel2704
    @niangel2704 8 месяцев назад

    You are a star!! Very helpfull approach!! Thanx for the tutorial!!

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

    Well done easy to follow thank you.

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

    this is really nice. thank you

  • @omostan
    @omostan Месяц назад

    I have to agree with what @ThomasSchmidt-Esterle wrote: very clear and straightforward. Many thanks for the simple yet concise explanation.

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

    Good stuff, thanks a lot!

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

    Thank you!

  • @grouchograyson498
    @grouchograyson498 8 месяцев назад

    Thankyou brother.

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

    very interesting

  • @MrBiohazard542
    @MrBiohazard542 10 месяцев назад +1

    will the "theme change" on the main window also be applied throughout the operation of the application such as a user being re-directed to a new window? or this color change is only applied to one certain window?

    • @TacticDevs
      @TacticDevs  10 месяцев назад +1

      The theme will apply to the entire application because the resource dictionary resource is available through the app class which makes it available in all the windows

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

    How do I can use it with color animations?

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

    Could you add a x:Name and only change the source property Source? Or is there something that I missed?

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

      Would this work for you in this instance?
      ResourceDictionary Theme = new ResourceDictionary() {Source="URI"};
      App.Current.Resources.Remove("Dark");
      App.Current.Resources.Add("Light", Theme);
      Because I want to work with a lot of merge dictionaries, and I don't want to lose that ability

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

      Unfortunately you can’t add a key to the resource dictionary itself but only to its contents

  • @tombobadil2331
    @tombobadil2331 9 месяцев назад

    Don't you need to clear the MergedDictionaries as well, before adding every time?

    • @TacticDevs
      @TacticDevs  9 месяцев назад

      We do not need to clear the dictionaries cause they contain the styling and they are defined as resources. We only need to switch between light and dark