相关疑难解决方法(0)

如何在Visual Studio中提取默认控件模板?

我想知道如何使用Visual Studio提取(获取副本)给定控件的默认模板.我知道这可以通过Expression Blend(右键单击控件,"编辑模板" - >"编辑副本...")来完成,然后在我的Xaml中复制默认控件模板.但这可以用Visual Studio完成吗?

wpf xaml visual-studio

52
推荐指数
4
解决办法
3万
查看次数

如何更改 WPF CheckBox 控件中 CheckMark 的颜色?

我有一个自定义模板复选框,我正在使用视图框(使用视图框允许简单缩放)实现它,我无法弄清楚如何更改选中/取消选中复选框时显示的内容。

我希望选中时复选标记为红色(不是最终外观,只是想看看它是否有效)。

我的复选框样式:

<Style x:Key="KioskCheckBox" TargetType="{x:Type CheckBox}">
        <Setter Property="FontFamily" Value="{StaticResource FontFamilyLight}" />
        <Setter Property="FontSize" Value="{StaticResource KioskNormalFontSize}" />
        <Setter Property="Foreground" Value="{StaticResource brshSystemTextColor}" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="CheckBox">

                        <!--<Viewbox HorizontalAlignment="Left" 
                                 VerticalAlignment="Top"
                                 Stretch="Fill" 
                                 Height="30"   
                                 Width="30" Margin="10,0,0,0">
                            <Grid Height="200" Width="200">
                                <Ellipse  
                                Fill="Transparent"
                                StrokeThickness="15" 
                                Stroke="{StaticResource brshSystemTextColor}"/>
                                <Path 
                                Stroke="{StaticResource brshSecondaryColor}"
                                Fill="Transparent" 
                                Stretch="None"
                                StrokeThickness="20"
                                Data="M 30,100 L 80,140 L 160,60" Margin="0,0,2,2"/>
                            </Grid>
                        </Viewbox>-->
                        <ContentControl>
                        <StackPanel Orientation="Horizontal">
                            <Viewbox HorizontalAlignment="Left" 
                                VerticalAlignment="Center"
                                Stretch="Fill" 
                                Height="30"   
                                Width="30" Margin="10,0,0,0">
                                <Grid Height="200" Width="200">
                                    <Ellipse  
                                        Fill="Transparent"
                                        StrokeThickness="15" 
                                        Stroke="{StaticResource brshSystemTextColor}"/>
                                    <Path 
                                        Stroke="{StaticResource brshSecondaryColor}"
                                        Fill="Transparent" 
                                        Stretch="None" …
Run Code Online (Sandbox Code Playgroud)

wpf controltemplate

5
推荐指数
1
解决办法
2万
查看次数

标签 统计

wpf ×2

controltemplate ×1

visual-studio ×1

xaml ×1