SB/XA Wiki
Advertisement
HDDButton

Hard Disk Save Button

The following two styles will change the template of a button to an image of a HDD when the button is the F2 button. The WikiSBButtonStyle is what you add to the Default styles for the button, doing this will apply the style to all the buttons in the application, and in the case they are the F2 button, the HDD will be visible.



<!-- Style for the actual button. -->    
<Style x:Key="WikiButtonStyle" BasedOn="{StaticResource DefaultSBButtonStyle}" TargetType="{x:Type Button}">
 <Setter Property="sbc:SBUISupport.StyleName" Value="WikiButtonStyle" />
    
    <Style.Triggers>
        <!-- No image from the server and button is F2. -->
 <MultiDataTrigger>
            <MultiDataTrigger.Conditions>
                <Condition Binding="{Binding Path=(sbc:SBGUIAttribute.SBGraphic), RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type sbc:SBButton}}, Converter={StaticResource SBIsNullOrEmptyConverter}, Mode=OneWay }" Value="true" />
                <Condition Binding="{Binding Path=(sbc:SBGUIAttribute.SBBackground), RelativeSource={RelativeSource Mode=TemplatedParent}, Mode=OneWay, Converter={StaticResource SBIsNullOrEmptyConverter}}" Value="true" />
                <Condition Binding="{Binding Path=(sbc:SBGUIAttribute.SBForeground), RelativeSource={RelativeSource Mode=TemplatedParent}, Mode=OneWay, Converter={StaticResource SBIsNullOrEmptyConverter}}" Value="true" />
                <Condition Binding="{Binding Path=GuiObjectDefinition.UserObjectName, RelativeSource={RelativeSource Mode=TemplatedParent}, Mode=OneWay}" Value="FK2" />
            </MultiDataTrigger.Conditions>
            <Setter Property="Template" Value="{StaticResource SaveButtonTemplate}" />
        </MultiDataTrigger>

 </Style.Triggers>
</Style>

<Style x:Key="WikiSBButtonStyle" BasedOn="{StaticResource BaseSBButtonStyle}" TargetType="{x:Type sbc:SBButton}">
 <Setter Property="sbc:SBControl.SBControlStyle" Value="{DynamicResource WikiButtonStyle}" />
    <Setter Property="sbc:SBUISupport.StyleName" Value="WikiSBButtonStyle" />
</Style>

The HDD graphic is provided by the following template;

<!-- This template contains an image of a hard disk drive. -->
<ControlTemplate x:Key="SaveButtonTemplate" TargetType="{x:Type Button}">

    <Viewbox Stretch="Uniform">
        <Canvas Width="79.5" Height="58.148" RenderTransform="Identity">
            <Canvas Canvas.Left="0.5" Canvas.Top="0.">
                <Canvas RenderTransform="1,0,0,1,62.25,-0.389105290174484">
                    <Path Fill="#FFD3D7CF" StrokeThickness="1" Data="F1M-23.258,2.906C-27.092,2.906,-30.717,3.428,-33.845,4.326L-45.724,4.326 -62.250,33.247 -60.250,58.037 14.250,58.037 16.250,33.247C16.250,33.247,0.479,6.159,-0.276,4.326L-12.736,4.326C-15.862,3.429,-19.427,2.906,-23.258,2.906z"/>
                    <Canvas RenderTransform="0.914449989795685,0,0,0.914449989795685,94.7092895507813,-92.4347381591797"/>
                    <Canvas RenderTransform="1,0,0,1,30.0954895019531,-86.8936004638672"/>
                    <Rectangle Fill="#FFD3D7CF" Width="76" Height="24" Canvas.Left="-61" Canvas.Top="30.787"/>
                    <Rectangle Fill="#FF555753" Width="2" Height="16" Canvas.Left="-8.573" Canvas.Top="35.123"/>
                    <Rectangle Fill="#FFEEEEEC" Width="2" Height="16" Canvas.Left="-6.573" Canvas.Top="35.123"/>
                    <Path Fill="#FFEEEEEC" StrokeThickness="1" Data="F1M-62.000,30.037L-46.000,2.037 -2.000,2.037C-1.269,3.812,14.000,30.037,14.000,30.037L-62.000,30.037z"/>
                    <Rectangle Fill="#FF555753" Width="2" Height="16" Canvas.Left="-2.823" Canvas.Top="35.248"/>
                    <Rectangle Fill="#FFEEEEEC" Width="2" Height="16" Canvas.Left="-0.823" Canvas.Top="35.248"/>
                    <Rectangle Fill="#FF555753" Width="2" Height="16" Canvas.Left="3.177" Canvas.Top="35.373"/>
                    <Rectangle Fill="#FFEEEEEC" Width="2" Height="16" Canvas.Left="5.177" Canvas.Top="35.373"/>
                    <Path Fill="#FFBABDB6" Stroke="White" StrokeThickness="2" StrokeStartLineCap="Round" StrokeEndLineCap="Round" StrokeDashCap="Round" StrokeMiterLimit="4" Data="F1M-61.000,30.787C-57.000,30.787,14.250,30.787,14.250,30.787"/>
                    <Path StrokeThickness="2.408" StrokeStartLineCap="Round" StrokeEndLineCap="Round" StrokeDashCap="Round" StrokeMiterLimit="4" Data="F1M3.083,16.048C3.083,23.258 -8.271,29.109 -22.260,29.109 -36.250,29.109 -47.604,23.258 -47.604,16.048 -47.604,8.839 -36.250,2.987 -22.260,2.987 -8.271,2.987 3.083,8.839 3.083,16.048z">
                        <Path.Stroke>
                            <LinearGradientBrush StartPoint="-22.26,-2.258" EndPoint="-22.26,23.711" MappingMode="Absolute" SpreadMethod="Pad">
                                <GradientStop Color="#FFD3D7CF" Offset="0"/>
                                <GradientStop Color="#FFECECE9" Offset="1"/>
                            </LinearGradientBrush>
                        </Path.Stroke>
                    </Path>
                    <Canvas RenderTransform="2,0,0,2,23,-29.2130355834961">
                        <Path Fill="#FFA40000" StrokeThickness="1" StrokeStartLineCap="Round" StrokeEndLineCap="Round" StrokeDashCap="Round" StrokeMiterLimit="4" RenderTransform="0.67279052734375,0,0,0.67279052734375,-13.02760887146,12.3939933776855" Data="F1M-33.411,35.272A2.652,2.652,0.000,1,1,-38.714,35.272A2.652,2.652,0.000,1,1,-33.411,35.272z">
                            <Path.Stroke>
                                <LinearGradientBrush StartPoint="-36.799,32.12" EndPoint="-35.512,37.873" MappingMode="Absolute" SpreadMethod="Pad">
                                    <GradientStop Color="#FF555753" Offset="0"/>
                                    <GradientStop Color="#00555753" Offset="1"/>
                                </LinearGradientBrush>
                            </Path.Stroke>
                        </Path>
                        <Path StrokeThickness="1" RenderTransform="0.535658478736877,0,0,0.443991810083389,-18.4293804168701,20.0450057983398" Data="F1M-33.411,35.272A2.652,2.652,0.000,1,1,-38.714,35.272A2.652,2.652,0.000,1,1,-33.411,35.272z">
                            <Path.Fill>
                                <RadialGradientBrush Center="-36.062,35.272" RadiusX="2.652" RadiusY="2.652" GradientOrigin="-36.062,35.272" MappingMode="Absolute">
                                    <GradientStop Color="White" Offset="0"/>
                                    <GradientStop Color="Transparent" Offset="1"/>
                                </RadialGradientBrush>
                            </Path.Fill>
                        </Path>
                    </Canvas>
                    <Canvas RenderTransform="2,0,0,2,23,-29.2130355834961">
                        <Path Fill="#FF4E9A06" StrokeThickness="1" StrokeStartLineCap="Round" StrokeEndLineCap="Round" StrokeDashCap="Round" StrokeMiterLimit="4" RenderTransform="0.67279052734375,0,0,0.67279052734375,-7.02760887145996,12.3939933776855" Data="F1M-33.411,35.272A2.652,2.652,0.000,1,1,-38.714,35.272A2.652,2.652,0.000,1,1,-33.411,35.272z">
                            <Path.Stroke>
                                <LinearGradientBrush StartPoint="-36.799,32.12" EndPoint="-35.512,37.873" MappingMode="Absolute" SpreadMethod="Pad">
                                    <GradientStop Color="#FF555753" Offset="0"/>
                                    <GradientStop Color="#00555753" Offset="1"/>
                                </LinearGradientBrush>
                            </Path.Stroke>
                        </Path>
                        <Path StrokeThickness="1" RenderTransform="0.485658496618271,0,0,0.443991810083389,-13.9673376083374,20.0008106231689" Data="F1M-33.411,35.272A2.652,2.652,0.000,1,1,-38.714,35.272A2.652,2.652,0.000,1,1,-33.411,35.272z">
                            <Path.Fill>
                                <RadialGradientBrush Center="-36.062,35.272" RadiusX="2.652" RadiusY="2.652" GradientOrigin="-36.062,35.272" MappingMode="Absolute">
                                    <GradientStop Color="White" Offset="0"/>
                                    <GradientStop Color="Transparent" Offset="1"/>
                                </RadialGradientBrush>
                            </Path.Fill>
                        </Path>
                    </Canvas>
                    <Path Stroke="Black" StrokeThickness="2.046" StrokeStartLineCap="Round" StrokeEndLineCap="Round" StrokeDashCap="Round" StrokeLineJoin="Bevel" StrokeMiterLimit="4" Data="F1M-23.250,1.412C-26.961,1.412,-30.471,1.917,-33.500,2.787L-45.000,2.787 -61.000,30.787 -61.000,54.787 15.000,54.787 15.000,30.787C15.000,30.787,-0.269,4.562,-1.000,2.787L-13.063,2.787C-16.090,1.918,-19.541,1.412,-23.250,1.412z"/>
                    <Path StrokeThickness="2.18" StrokeStartLineCap="Round" StrokeEndLineCap="Round" StrokeDashCap="Round" StrokeMiterLimit="4" Data="F1M0.411,15.781C0.411,9.255 -9.866,3.959 -22.528,3.959 -35.190,3.959 -45.466,9.255 -45.466,15.781 -45.466,22.306 -35.190,27.602 -22.528,27.602 -9.866,27.602 0.411,22.306 0.411,15.781z">
                        <Path.Stroke>
                            <LinearGradientBrush StartPoint="-22.528,32.349" EndPoint="-22.528,8.845" MappingMode="Absolute" SpreadMethod="Pad">
                                <GradientStop Color="White" Offset="0"/>
                                <GradientStop Color="#FFEAEBE8" Offset="1"/>
                            </LinearGradientBrush>
                        </Path.Stroke>
                    </Path>
                </Canvas>
            </Canvas>
        </Canvas>
    </Viewbox>

    <ControlTemplate.Triggers>
        <Trigger Property="IsEnabled" Value="false">
            <Setter Property="Foreground" Value="#ADADAD"/>
        </Trigger>
    </ControlTemplate.Triggers>
    
</ControlTemplate>

Note that the template must be defined before the styles that reference it, otherwise the XAML compilers will not find it.



This style was tested in 6.0.1.2135

Advertisement