WPFDevelopersOrg / WPFDevelopers

🎉 Welcome to follow the "WPFDevelopers" public account! This is a sample project we share daily, covering WPF's basic controls and custom control libraries. The project will be continuously updated, welcome to give us ⭐️
MIT License
1.5k stars 240 forks source link

ToggleButton建议 #66

Closed wanghaodong0824 closed 8 months ago

wanghaodong0824 commented 11 months ago

ToggleButton希望可以把为true的时候自己改背景色,接口留出来。谢谢华哥

yanjinhuagood commented 11 months ago

修改如下 继承WD.DefaultToggleButton修改触发器IsChecked为true时设置Background的颜色即可

                            <Style BasedOn="{StaticResource WD.DefaultToggleButton}" TargetType="{x:Type ToggleButton}">
                                <Style.Triggers>
                                    <Trigger Property="IsChecked" Value="True">
                                        <Setter Property="Background" Value="Green" />
                                    </Trigger>
                                </Style.Triggers>
                            </Style>