mirror of
https://github.com/VitalickS/BrightSharp.Toolkit.git
synced 2026-03-21 02:21:15 +00:00
Ver 2.0. Fixes and improvements.
This commit is contained in:
27
BrightSharp.Ui.Tests/BrushesMapList.cs
Normal file
27
BrightSharp.Ui.Tests/BrushesMapList.cs
Normal file
@@ -0,0 +1,27 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Windows;
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace BrightSharp.Ui.Tests
|
||||
{
|
||||
public class BrushesMapList : Dictionary<string, object>
|
||||
{
|
||||
public BrushesMapList() {
|
||||
var dic = Application.Current.Resources.MergedDictionaries.First();
|
||||
foreach (string key in dic.Keys.OfType<string>().OrderBy(x => x)) {
|
||||
var value = Application.Current.TryFindResource(key);
|
||||
if (value != null) {
|
||||
bool isBorder = key.Contains("Border");
|
||||
if (value is Color col) {
|
||||
Add(key, new { Type = "C", Brush = new SolidColorBrush(col), IsBorder = isBorder });
|
||||
}
|
||||
else if (value is Brush br) {
|
||||
Add(key, new { Type = "Br", Brush = br, IsBorder = isBorder });
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user