UWP 从 inkToolbarPenButton 移除大小滑块

UWP remove size slider from inkToolbarPenButton

我正在尝试创建一个 InkToolbar whose ballpens and pencils' size can't be changed. Basically, the actual appearance is this one (the button has a slider with a "size" text) and I want to remove it so it looks like this, without that slider. I've read the whole tutorial about custom ink toolbars,但我找不到要删除的 属性。事实上,我不确定我是否可以这样做。 有什么方法可以防止用户看到和使用这个尺寸 属性?

您可以自定义 InkToolbarPenConfigurationControl 位于您电脑的 Generic.xaml

详情。

第一步,打开Generic.xaml,找到文字<Style TargetType="InkToolbarPenConfigurationControl">,将整个Style复制出来,也可以在my gist.

上看到

第 2 步,将样式代码粘贴到您的 App.xaml。请注意,这将覆盖所有 InkToolbarPen 按钮。

<Application
    x:Class="App2.App"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:App2">
    <Application.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="/FavoriteButtonStyle.xaml"/>
                <ResourceDictionary Source="/BorderlessGridViewItem.xaml"/>
            </ResourceDictionary.MergedDictionaries>


            <!--Paste your style code here-->

        </ResourceDictionary>
    </Application.Resources>
</Application>

第三步,找到Slider控件,将Visibility设置为Collapsed。完成!!!