punker76 on develop
Update MessageDialog.cs Fix De… Merge pull request #4247 from c… (compare)
punker76 on develop
Updated readme with some additi… Merge pull request #4296 from n… (compare)
BasedOn="{StaticResource MahApps.Styles.ComboBox}"
hello everyone,
I "composed" a style for tooglebutton. It seems the style and the button itself live different lifes
Could someone look at code?
App.xaml
<Style
x:Key="CustomToggleButtonStyle"
BasedOn="{StaticResource MahApps.Styles.ToggleButton.Flat}"
TargetType="{x:Type ToggleButton}">
<Setter Property="Background" Value="WhiteSmoke" />
<Setter Property="BorderBrush" Value="Black" />
<Setter Property="BorderThickness" Value="1" />
<Setter Property="Padding" Value="0" />
<Setter Property="Margin" Value="6" />
<Setter Property="MaxWidth" Value="35" />
<Setter Property="Focusable" Value="False" />
<Setter Property="ContentTemplate" Value="{DynamicResource Template.Button.ViewBox}" />
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="LightGray" />
<Setter Property="Foreground" Value="Black" />
</Trigger>
<Trigger Property="IsChecked" Value="True">
<Setter Property="Background" Value="LimeGreen" />
<Setter Property="Foreground" Value="Black" />
</Trigger>
</Style.Triggers>
</Style>
MainWindow.xaml
<ToggleButton
Grid.Row="0"
Content="Toggle me"
IsChecked="{Binding BooleanValue, Mode=OneWay}"
Style="{StaticResource CustomToggleButtonStyle}">
</ToggleButton>
The issue is: it seems there's no response upon binding. In other words it becomes green by itself,
not by binding. What I'm dong wrong?
Mode=TwoWay
DynamicResource
in your App.xaml
or in any Resources
section