Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Missing style for RepeatButton #1191

Closed
Mythos opened this issue Mar 21, 2014 · 2 comments
Closed

Missing style for RepeatButton #1191

Mythos opened this issue Mar 21, 2014 · 2 comments
Assignees
Milestone

Comments

@Mythos
Copy link

Mythos commented Mar 21, 2014

Hi,
unfortunately there's a style missing for the RepeatButton control.

I tried to create a style with BasedOn="{StaticResource {x:Type Button}}", but it's not working.
It would be really cool if someone could add it.

Regards,
Mythos

@kiangtengl
Copy link
Contributor

In your window

<RepeatButton Style="{StaticResource MetroSSSButton}"/>

In your resource dictionary

<Style TargetType="{x:Type ButtonBase}"
           x:Key="MetroSSSButton">
        <Setter Property="MinHeight"
                Value="25" />
        <Setter Property="FontWeight"
                Value="Bold" />
        <Setter Property="FontSize"
                Value="{DynamicResource UpperCaseContentFontSize}" />
        <Setter Property="FontFamily"
                Value="{DynamicResource DefaultFont}" />
        <Setter Property="Background"
                Value="{DynamicResource GrayBrush10}" />
        <Setter Property="BorderBrush"
                Value="{DynamicResource TextBoxBorderBrush}" />
        <Setter Property="Foreground"
                Value="{DynamicResource TextBrush}" />
        <Setter Property="Padding"
                Value="5,6" />
        <Setter Property="BorderThickness"
                Value="1" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="ButtonBase">
                    <Grid>
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualState x:Name="Normal" />
                                <VisualState x:Name="MouseOver">
                                    <Storyboard>
                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)"
                                                                       Storyboard.TargetName="MouseOverBorder">
                                            <EasingDoubleKeyFrame KeyTime="0"
                                                                  Value="1" />
                                        </DoubleAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Pressed">
                                    <Storyboard>
                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)"
                                                                       Storyboard.TargetName="PressedBorder">
                                            <EasingDoubleKeyFrame KeyTime="0"
                                                                  Value="1" />
                                        </DoubleAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Disabled">
                                    <Storyboard>
                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="Opacity"
                                                                       Storyboard.TargetName="DisabledVisualElement">
                                            <SplineDoubleKeyFrame KeyTime="0"
                                                                  Value="0.7" />
                                        </DoubleAnimationUsingKeyFrames>
                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)"
                                                                       Storyboard.TargetName="contentPresenter">
                                            <EasingDoubleKeyFrame KeyTime="0"
                                                                  Value="0.3" />
                                        </DoubleAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="FocusStates">
                                <VisualState x:Name="Focused">
                                    <Storyboard>
                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)"
                                                                       Storyboard.TargetName="FocusRectangle">
                                            <EasingDoubleKeyFrame KeyTime="0"
                                                                  Value="1" />
                                        </DoubleAnimationUsingKeyFrames>
                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)"
                                                                       Storyboard.TargetName="FocusInnerRectangle">
                                            <EasingDoubleKeyFrame KeyTime="0"
                                                                  Value="1" />
                                        </DoubleAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Unfocused" />
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <Border x:Name="Background"
                                BorderBrush="{TemplateBinding BorderBrush}"
                                BorderThickness="{TemplateBinding BorderThickness}"
                                Background="{TemplateBinding Background}"
                                CornerRadius="3" />
                        <Rectangle x:Name="DisabledVisualElement"
                                   Fill="{DynamicResource ControlsDisabledBrush}"
                                   IsHitTestVisible="false"
                                   Opacity="0"
                                   RadiusY="3"
                                   RadiusX="3" />
                        <Border x:Name="MouseOverBorder"
                                Background="{DynamicResource GrayBrush8}"
                                BorderThickness="{TemplateBinding BorderThickness}"
                                CornerRadius="3.5"
                                Opacity="0" />
                        <Border x:Name="PressedBorder"
                                Background="{DynamicResource GrayBrush7}"
                                BorderThickness="{TemplateBinding BorderThickness}"
                                CornerRadius="3.5"
                                Opacity="0" />
                        <Rectangle x:Name="FocusRectangle"
                                   Stroke="{DynamicResource ButtonMouseOverInnerBorderBrush}"
                                   RadiusY="4"
                                   RadiusX="4"
                                   Margin="-1"
                                   Opacity="0" />
                        <Rectangle x:Name="FocusInnerRectangle"
                                   StrokeThickness="{TemplateBinding BorderThickness}"
                                   Stroke="{DynamicResource ButtonMouseOverBorderBrush}"
                                   RadiusX="3"
                                   RadiusY="3"
                                   Opacity="0" />
                        <ContentPresenter x:Name="contentPresenter"
                                          RecognizesAccessKey="True"
                                          ContentTemplate="{TemplateBinding ContentTemplate}"
                                          Content="{TemplateBinding Content, Converter={StaticResource ToUpperConverter}}"
                                          HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                          Margin="{TemplateBinding Padding}"
                                          VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

@punker76 punker76 added this to the v0.14 milestone Mar 24, 2014
@AzureKitsune
Copy link
Member

@kiangtengl Could you submit that in a pull request?

@flagbug flagbug removed this from the v0.14 milestone Aug 2, 2014
@punker76 punker76 self-assigned this Jan 10, 2015
@punker76 punker76 removed their assignment Nov 9, 2015
@punker76 punker76 added this to the 1.4.0 milestone Jul 8, 2016
@punker76 punker76 modified the milestones: 1.3.0, 1.4.0 Jul 22, 2016
@punker76 punker76 self-assigned this Jul 22, 2016
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Development

No branches or pull requests

5 participants