Posted 16 years ago by Bryan Livingston
Version: 3.5.0427
Avatar
I built a quick and dirty theme browser, so that you can visually see what keys are available and what their values are. I figured I'd share the code. It creates a button with the background set to each brush.

using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;

using ActiproSoftware.Windows.Themes;

namespace Vector
{
    public partial class TestWindow
    {
        public TestWindow()
        {
            this.InitializeComponent();

            foreach (string group in ThemeManager.GetGroupsForTheme(ThemeManager.CurrentTheme))
            {
                var dictionary = ThemeManager.GetResourceDictionary(ThemeManager.CurrentTheme, group);
                foreach (var merged in dictionary.MergedDictionaries)
                {
                    foreach (var item in merged.Keys)
                    {
                        var key = item as ResourceKey;
                        if (key != null)
                            Target.Children.Add(new Button() { Background = dictionary[key] as Brush, Content = key.ToString() });
                    }
                }
            }
        }
    }
}

Comments (2)

Posted 16 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Thanks for posting that Bryan. We've had on our TODO list to make a browser too but haven't had a chance to get to it yet. This should be helpful for many customers.


Actipro Software Support

Posted 16 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hey Bryan and everyone. Just wanted to let you know that we have completed a Theme Browser demo for WPF Studio v4.0. Feedback on it so far is very positive. It browses all theme brushes and even lets you copy resource keys to the clipboard for easy pasting into your application.


Actipro Software Support

The latest build of this product (v24.1.1) was released 2 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.