diff options
Diffstat (limited to 'Software/Visual_Studio/Tango.BrushPicker')
3 files changed, 37 insertions, 1 deletions
diff --git a/Software/Visual_Studio/Tango.BrushPicker/Converters/BrushToGradientStopsConverter.cs b/Software/Visual_Studio/Tango.BrushPicker/Converters/BrushToGradientStopsConverter.cs new file mode 100644 index 000000000..077e44562 --- /dev/null +++ b/Software/Visual_Studio/Tango.BrushPicker/Converters/BrushToGradientStopsConverter.cs @@ -0,0 +1,31 @@ +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Data; +using System.Windows.Media; + +namespace Tango.BrushPicker.Converters +{ + public class BrushToGradientStopsConverter : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + Brush brush = value as LinearGradientBrush; + + if (brush != null) + { + return (brush as LinearGradientBrush).GradientStops; + } + + return null; + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + } +} diff --git a/Software/Visual_Studio/Tango.BrushPicker/Tango.BrushPicker.csproj b/Software/Visual_Studio/Tango.BrushPicker/Tango.BrushPicker.csproj index c007f793d..2c1bae3d9 100644 --- a/Software/Visual_Studio/Tango.BrushPicker/Tango.BrushPicker.csproj +++ b/Software/Visual_Studio/Tango.BrushPicker/Tango.BrushPicker.csproj @@ -60,6 +60,7 @@ <Compile Include="..\Versioning\GlobalVersionInfo.cs"> <Link>GlobalVersionInfo.cs</Link> </Compile> + <Compile Include="Converters\BrushToGradientStopsConverter.cs" /> <Compile Include="Implementation\AlphaSelector.cs" /> <Compile Include="Implementation\BaseSelector.cs" /> <Compile Include="Implementation\BrushPicker.cs" /> @@ -85,6 +86,7 @@ <SubType>Designer</SubType> </Page> </ItemGroup> + <ItemGroup /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <!-- To modify your build process, add your task inside one of the targets below and uncomment it. Other similar extension points exist, see Microsoft.Common.targets. diff --git a/Software/Visual_Studio/Tango.BrushPicker/Themes/Generic.xaml b/Software/Visual_Studio/Tango.BrushPicker/Themes/Generic.xaml index 5b1bcbbc3..b496be57b 100644 --- a/Software/Visual_Studio/Tango.BrushPicker/Themes/Generic.xaml +++ b/Software/Visual_Studio/Tango.BrushPicker/Themes/Generic.xaml @@ -11,8 +11,11 @@ <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + xmlns:converters="clr-namespace:Tango.BrushPicker.Converters" xmlns:local="clr-namespace:Tango.BrushPicker"> + <converters:BrushToGradientStopsConverter x:Key="BrushToGradientStopsConverter" /> + <Geometry x:Key="SkewIcon">M456.021,227.816L545.590,227.816L456.021,362.171L366.452,362.171L456.021,227.816</Geometry> <Geometry x:Key="TranslateIcon">M384,289.828L384,363L457.171,363M384,363L457.171,289.828M480,267L480,310.011L435.711,267L480,267</Geometry> <Geometry x:Key="RotateIcon">F1 M 32.0034,13.0019L 35.0033,16.002L 35.0034,24.0019L 27.0033,24.002L 24.0034,21.0019L 29.5944,21.0014C 28.2209,19.4668 26.2249,18.501 24.0033,18.501C 19.8606,18.501 16.5022,21.8593 16.5022,26.002C 16.5022,28.0734 17.3418,29.9486 18.6992,31.3061L 16.2241,33.7812C 14.2332,31.7903 13.0018,29.0399 13.0018,26.0019C 13.0018,19.926 17.9274,15.0004 24.0033,15.0004C 27.1557,15.0004 29.9984,16.3263 32.0042,18.4508L 32.0034,13.0019 Z</Geometry> @@ -408,7 +411,7 @@ FocusVisualStyle="{x:Null}" ColorBox="{Binding RelativeSource={RelativeSource TemplatedParent}}"> <local:GradientStopAdder.Background> - <LinearGradientBrush GradientStops="{Binding Brush.GradientStops, RelativeSource={RelativeSource TemplatedParent}}" + <LinearGradientBrush GradientStops="{Binding Brush, RelativeSource={RelativeSource TemplatedParent},Converter={StaticResource BrushToGradientStopsConverter}}" StartPoint="0,.5" EndPoint="1,.5"/> </local:GradientStopAdder.Background> <Button.Style> |
