Click here to Skip to main content
15,898,134 members
Articles / Desktop Programming / WPF

Stacked Geometry Brush Factory

Rate me:
Please Sign up or sign in to vote.
4.95/5 (68 votes)
16 Jul 2010CPOL13 min read 80K   2.6K   103  
A geometric visual brush producer with plug-in architecture and customized XAML.
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">

    <DataTemplate x:Key="NeonFactoryTemplate">
        <DataTemplate.Resources>
            <Style TargetType="TextBox">
                <Setter Property="Margin" Value="1,1,1,1"/>
                <Setter Property="Height" Value="23"/>
            </Style>
            <Style TargetType="TextBlock">
                <Setter Property="Width" Value="93"/>
                <Setter Property="Margin" Value="3,6,1,1"/>
            </Style>
            <Style TargetType="RadioButton">
                <Setter Property="Margin" Value="2,2,6,2"/>
                <Setter Property="Foreground" Value= "{Binding Path=Foreground ,  RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Expander}}}"/>
            </Style>
            <Style TargetType="Slider">
                <Setter Property="Margin" Value="8,3,1,2"/>
                <Setter Property="Width" Value="auto"/>
            </Style>
            <Style TargetType ="CheckBox">
                <Setter Property="Margin" Value="1,6,1,1"/>
                <Setter Property="Foreground" Value= "{Binding Path=Foreground ,  RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Expander}}}"/>

            </Style>
        </DataTemplate.Resources>
        <Grid Margin="6,6,6,6">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="90"/>
                <ColumnDefinition Width="50"/>
                <ColumnDefinition Width="*"/>
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions >
                <RowDefinition/>
                <RowDefinition/>
                <RowDefinition/>
                <RowDefinition/>
                <RowDefinition/>
                <RowDefinition/>
            </Grid.RowDefinitions>

            <CheckBox  Grid.Row="0" Grid.Column="0"  Grid.ColumnSpan="2" IsChecked="{Binding Path=IsFrozen}" >Is the factory frozen</CheckBox>
            
            <TextBlock Grid.Row="1">Hue</TextBlock>
            <TextBox   Grid.Row="1" Grid.Column="1" Text ="{Binding   Path=Hue  }" />
            <Slider    Grid.Row="1" Grid.Column="2" Maximum="360" Minimum="0" Value="{Binding Path=Hue}" ></Slider>

            <TextBlock Grid.Row="2">Center Brightness</TextBlock>

            <TextBox   Grid.Row="2" Grid.Column="1" Text ="{Binding   Path=StartingBrightness  }" />
            <Slider    Grid.Row="2" Grid.Column="2" Maximum="1" Minimum="0" Value="{Binding Path=StartingBrightness}"/>

            <TextBlock Grid.Row="3">Center Saturation</TextBlock>
            <TextBox   Grid.Row="3" Grid.Column="1" Text ="{Binding   Path=StartingSaturation  }" />
            <Slider    Grid.Row="3" Grid.Column="2" Maximum="1" Minimum="0" Value="{Binding Path=StartingSaturation}"/>

            <TextBlock Grid.Row="4">Center Thickness</TextBlock>
            <TextBox   Grid.Row="4" Grid.Column="1" Text ="{Binding   Path=StartingThickness  }" />
            <Slider    Grid.Row="4" Grid.Column="2" Maximum="5" Minimum="0" Value="{Binding Path=StartingThickness}"/>


            <TextBlock Grid.Row="5">Glow</TextBlock>
            <TextBox   Grid.Row="5" Grid.Column="1" Text ="{Binding   Path=GlowMultiplier  }" />
            <Slider    Grid.Row="5" Grid.Column="2" Maximum="3" Minimum="0" Value="{Binding Path=GlowMultiplier}"/>


        </Grid>
    </DataTemplate>
</ResourceDictionary>

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer (Senior)
United States United States
Written software for what seems like forever. I'm currenly infatuated with WPF. Hopefully my affections are returned.

Comments and Discussions