打开Toolkit源码中的Generic.xaml文件可以看到其默认样式,发现接结构组成元素为:

  1. ToggleSwitch

    其中,ToggleSwitch又由以下几个部分组成:

    • Header
    • Content
    • ToogleSwitchButton
  2. ToogleSwitchButton

    ToggleSwitchButton由以若干个Grid和Boder组成,它们分别是:

    • Grid:SwitchRoot
    • Grid:SwitchTrack
    • Grid:SwitchBottom
    • Rectangle:SwitchBackground(包含两个Border,A和B)
    • Border:SwitchThumb
    • Border:ThumbCenter

我们可以设置其各个元素显示不同的颜色,例如将各元素设为以下颜色:

  • Header.ForeGround – Blue
  • Content.ForeGround — Brown
  • ToggleSwitch.SwitchForeGround —Orange
  • SwitchRoot.Background — Black
  • SwitchTrack.Background — Green
  • SwitchBottom.Background — Green
  • SwitchBackground.BoderA.BorderBrush — Red
  • SwitchBackground.BoderA.BorderBrush — White
  • SwitchThumb.BorderBrush — Gold
  • ThumbCenter.BorderBrush — Aqua
  • ThumbCenter.Background — Chocolate

相关文章:

  • 2022-12-23
  • 2021-11-25
  • 2021-08-01
  • 2021-07-22
  • 2021-12-20
  • 2021-12-05
  • 2021-12-03
猜你喜欢
  • 2021-11-18
  • 2022-01-28
  • 2021-10-28
  • 2021-06-14
  • 2022-02-14
  • 2021-06-01
  • 2022-12-23
相关资源
相似解决方案