Wpf Thumb 默认样式存档,方便手头没有 vs 时查阅.

发布时间 2023-08-16 15:11:13作者: xiejiang
 1 <Style TargetType="{x:Type Thumb}">
 2     <Setter Property="Stylus.IsPressAndHoldEnabled" Value="false"/>
 3     <Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.ControlBrushKey}}"/>
 4     <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
 5     <Setter Property="Template">
 6         <Setter.Value>
 7             <ControlTemplate TargetType="{x:Type Thumb}">
 8                 <Border Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}">
 9                     <Grid>
10                         <Border Background="{DynamicResource {x:Static SystemColors.ControlBrushKey}}" BorderBrush="{DynamicResource {x:Static SystemColors.ControlDarkDarkBrushKey}}" BorderThickness="0,0,1,1"/>
11                         <Border Background="{DynamicResource {x:Static SystemColors.ControlLightLightBrushKey}}" BorderBrush="{DynamicResource {x:Static SystemColors.ControlDarkBrushKey}}" BorderThickness="0,0,1,1" Margin="1"/>
12                         <Border Background="{TemplateBinding Background}" Margin="2"/>
13                     </Grid>
14                 </Border>
15             </ControlTemplate>
16         </Setter.Value>
17     </Setter>
18 </Style>