如何在wpf中绘制扩展器(滑块)
我有一个要求,我需要一个按钮,让用户点击并向下/向上滑动,以扩展/折叠按钮上方的控件。如图所示:如何在wpf中绘制扩展器(滑块),wpf,xaml,Wpf,Xaml,我有一个要求,我需要一个按钮,让用户点击并向下/向上滑动,以扩展/折叠按钮上方的控件。如图所示: 如何在xaml中实现它?您可以为标题创建模板,并将问题中的图像放入标题模板。让我举一个例子: <Grid> <Grid.Resources> <Style TargetType="Border" x:Key="FooBorderStyle" > <Style.Resources>
如何在xaml中实现它?您可以为
标题创建模板
,并将问题中的图像放入标题模板
。让我举一个例子:
<Grid>
<Grid.Resources>
<Style TargetType="Border" x:Key="FooBorderStyle" >
<Style.Resources>
<LinearGradientBrush x:Key="ABackBrush" StartPoint="0.5,0" EndPoint="0.5,1">
<GradientStop Color="#EF3132" Offset="0.1" />
<GradientStop Color="#D62B2B" Offset="0.9" />
</LinearGradientBrush>
</Style.Resources>
<Setter Property="Background" Value="{StaticResource ABackBrush}"/>
</Style>
<DataTemplate x:Key="titleTemplate">
<Border Style="{StaticResource FooBorderStyle}" Height="24">
<Image Source="../Images/yourImage.png"
Margin="4 0"
VerticalAlignment="Center"/>
</Border>
</DataTemplate>
<Style TargetType="{x:Type Expander}">
<Setter Property="HeaderTemplate" Value="{StaticResource titleTemplate}"/>
</Style>
</Grid.Resources>
<Expander Name="hcontCtrl" Header="This is the header.">
<StackPanel>
<TextBox>This is a textbox</TextBox>
<Button>A button</Button>
</StackPanel>
</Expander>
</Grid>
这是一个文本框
钮扣
该图像非常不适合使用,因为它会与我页面的其他部分形成对比。“我能为Path做些什么吗?”AshishAgrawal是的,你能。在我看来,使用Microsoft Expression Design或Photoshop或其他图像工具编辑图像更简单。好的。也许我会试试这些工具中的一个。谢谢。@AshishAgrawal请随时提问。如果您觉得我的回复对您有帮助,那么您可以将我的回复标记为答案,以简化将来对其他人的搜索。请看这个