相关疑难解决方法(0)

使MahApps.Metro中的ProgressRing更小

看起来MahApps.Metro ProgressRing控件默认为最小尺寸为60x60.

ProgressRing有一个名为"IsLarge"的属性,但即使它被设置为"False",它似乎对能够使ProgressRing小于60x60没有影响.

不经意地改变高度和宽度属性也不会影响这一点.

将GitHUb视为ProgressRing的实际c#代码,看起来有几个属性会影响椭圆直径等,但这些属性是私有属性,不能从外部调用设置.

我怎样才能让它更小?说20x20或30x30?

在下面的代码中,我指定IsLarge = False,并将大小设置为30x30,但它仍然默认为60x60.

<Window x:Class="WpfApplication3.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:Controls="clr-namespace:MahApps.Metro.Controls;assembly=MahApps.Metro"
        Title="MainWindow" Height="350" Width="525">
    <Window.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Colours.xaml" />
                <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Fonts.xaml" />
                <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.xaml" />
                <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/Orange.xaml" />
                <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/BaseLight.xaml" />
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </Window.Resources>
         <Grid>
            <Controls:ProgressRing IsActive="True" IsLarge="False" Height="30" Width="30"></Controls:ProgressRing>
        </Grid>
</Window>
Run Code Online (Sandbox Code Playgroud)

下面是GitHub上的"ProgressRing.cs"文件的代码片段- MahApps.Metro

namespace MahApps.Metro.Controls
{
    [TemplateVisualState(Name = "Large", GroupName = "SizeStates")]
    [TemplateVisualState(Name = "Small", GroupName = "SizeStates")]
    [TemplateVisualState(Name = "Inactive", GroupName = "ActiveStates")]
    [TemplateVisualState(Name = "Active", GroupName = "ActiveStates")]
    public class …
Run Code Online (Sandbox Code Playgroud)

c# wpf mahapps.metro

6
推荐指数
1
解决办法
5698
查看次数

标签 统计

c# ×1

mahapps.metro ×1

wpf ×1