Click here to Skip to main content
15,885,032 members
Home / Discussions / WPF
   

WPF

 
AnswerRe: Expander in ListBoxItem Width Problem Pin
Richard Deeming1-May-23 23:09
mveRichard Deeming1-May-23 23:09 
GeneralRe: Expander in ListBoxItem Width Problem Pin
Kevin Marois2-May-23 7:12
professionalKevin Marois2-May-23 7:12 
QuestionSpinning Indicator Control Error Pin
Kevin Marois26-Apr-23 14:32
professionalKevin Marois26-Apr-23 14:32 
AnswerRe: Spinning Indicator Control Error Pin
Gerry Schmitz27-Apr-23 7:01
mveGerry Schmitz27-Apr-23 7:01 
GeneralRe: Spinning Indicator Control Error Pin
Kevin Marois27-Apr-23 7:27
professionalKevin Marois27-Apr-23 7:27 
GeneralRe: Spinning Indicator Control Error Pin
Gerry Schmitz28-Apr-23 4:46
mveGerry Schmitz28-Apr-23 4:46 
GeneralRe: Spinning Indicator Control Error Pin
Kevin Marois28-Apr-23 7:24
professionalKevin Marois28-Apr-23 7:24 
QuestionFlat Button Style Problem Pin
Kevin Marois22-Apr-23 18:14
professionalKevin Marois22-Apr-23 18:14 
I'm trying to create a flat button style:

Style
<Style x:Key="buttonStyle"
       TargetType="{x:Type Button}">

    <Setter Property="FocusVisualStyle" Value="{StaticResource FocusVisual}"/>
    <Setter Property="HorizontalContentAlignment" Value="Center"/>
    <Setter Property="VerticalContentAlignment" Value="Center"/>
    <Setter Property="Margin" Value="0"/>
    <Setter Property="Padding" Value="0"/>
    <Setter Property="BorderThickness" Value="0"/>
    <Setter Property="Height" Value="25"/>
    <Setter Property="Width" Value="75"/>

    <Setter Property="Template">
        <Setter.Value>
            <ControlTemplate TargetType="{x:Type Button}">

                <Border x:Name="border"
                        Margin="2"
                        Background="{TemplateBinding Background}"
                        BorderBrush="{TemplateBinding BorderBrush}"
                        BorderThickness="{TemplateBinding BorderThickness}"
                        CornerRadius="{TemplateBinding BorderThickness}">

                    <ContentPresenter x:Name="contentPresenter"
                                      HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                      RecognizesAccessKey="True"
                                      SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
                                      VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                                      TextElement.Foreground="{TemplateBinding Foreground}"/>

                </Border>

                <ControlTemplate.Triggers>

                    <Trigger Property="IsMouseOver" Value="true">
                        <Setter TargetName="border" Property="BorderBrush" Value="{StaticResource Button.Hover.Foreground}" />
                        <Setter TargetName="border" Property="BorderThickness" Value="1" />
                    </Trigger>

                    <Trigger Property="IsPressed" Value="true">
                        <Setter TargetName="border" Property="BorderBrush" Value="{StaticResource Button.Pressed.Foreground}" />
                        <Setter TargetName="border" Property="BorderThickness" Value="1" />
                    </Trigger>

                    <Trigger Property="IsEnabled" Value="false">
                        <Setter TargetName="border" Property="BorderBrush" Value="{StaticResource Button.Disabled.Foreground}" />
                        <Setter TargetName="border" Property="BorderThickness" Value="0" />
                    </Trigger>

                </ControlTemplate.Triggers>

            </ControlTemplate>
        </Setter.Value>
    </Setter>

</Style>
Usage
<Button Grid.Row="5"
        Grid.Column="0"
        IsDefault="True"
        Content="Test"
        Command="{Binding SignInCommand}"
        Style="{DynamicResource buttonStyle}"
        Background="LightSeaGreen"
        Foreground="Red"
        Margin="0,25,0,0"/>
The problem is that the foreground doesn't change. I know it's probably the ContentPresenter, but I don't know what to do about it. What's the right way to fix this?
If it's not broken, fix it until it is.
Everything makes sense in someone's mind.
Ya can't fix stupid.

AnswerRe: Flat Button Style Problem Pin
Gerry Schmitz23-Apr-23 8:55
mveGerry Schmitz23-Apr-23 8:55 
GeneralRe: Flat Button Style Problem Pin
Kevin Marois23-Apr-23 9:15
professionalKevin Marois23-Apr-23 9:15 
GeneralRe: Flat Button Style Problem Pin
Gerry Schmitz23-Apr-23 15:28
mveGerry Schmitz23-Apr-23 15:28 
GeneralRe: Flat Button Style Problem Pin
Kevin Marois25-Apr-23 19:08
professionalKevin Marois25-Apr-23 19:08 
GeneralRe: Flat Button Style Problem Pin
Gerry Schmitz26-Apr-23 5:20
mveGerry Schmitz26-Apr-23 5:20 
QuestionReport Designer Suggestions Pin
Kevin Marois13-Apr-23 13:37
professionalKevin Marois13-Apr-23 13:37 
AnswerRe: Report Designer Suggestions Pin
Pete O'Hanlon13-Apr-23 21:23
mvePete O'Hanlon13-Apr-23 21:23 
AnswerRe: Report Designer Suggestions Pin
Gerry Schmitz14-Apr-23 3:51
mveGerry Schmitz14-Apr-23 3:51 
QuestionCustom Navigation Control Pin
Kevin Marois12-Apr-23 16:23
professionalKevin Marois12-Apr-23 16:23 
AnswerRe: Custom Navigation Control Pin
Pete O'Hanlon13-Apr-23 21:36
mvePete O'Hanlon13-Apr-23 21:36 
AnswerRe: Custom Navigation Control Pin
Richard Deeming13-Apr-23 22:47
mveRichard Deeming13-Apr-23 22:47 
GeneralRe: Custom Navigation Control Pin
Kevin Marois15-Apr-23 10:22
professionalKevin Marois15-Apr-23 10:22 
GeneralRe: Custom Navigation Control Pin
Pete O'Hanlon16-Apr-23 21:54
mvePete O'Hanlon16-Apr-23 21:54 
GeneralRe: Custom Navigation Control Pin
Kevin Marois17-Apr-23 5:10
professionalKevin Marois17-Apr-23 5:10 
GeneralRe: Custom Navigation Control Pin
Pete O'Hanlon17-Apr-23 10:52
mvePete O'Hanlon17-Apr-23 10:52 
GeneralRe: Custom Navigation Control Pin
Kevin Marois22-Apr-23 17:54
professionalKevin Marois22-Apr-23 17:54 
GeneralRe: Custom Navigation Control Pin
Pete O'Hanlon23-Apr-23 21:09
mvePete O'Hanlon23-Apr-23 21:09 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.