- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我注意到 MahApps Metro 提供的 SquareButtonStyle 没有 1 像素的边框。我正在寻找符合这种风格的东西:(Visual Studio 的按钮样式)
而 Metro Style 是这样的:
我已经查看了按钮样式的 XAML,但它显示该按钮的边框粗细为 1。如果其他按钮的边框粗细为 1px,这怎么可能呢,就像上面的按钮一样?我如何像我显示的关闭按钮一样覆盖此按钮。
这是 button.xaml 的链接(已编辑链接):https://github.com/MahApps/MahApps.Metro/blob/master/MahApps.Metro/Styles/Controls.Buttons.xaml
这是 SquareButton xaml:
<Style x:Key="SquareButtonStyle"
TargetType="{x:Type Button}">
<Setter Property="MinHeight"
Value="25" />
<Setter Property="FontFamily"
Value="{DynamicResource DefaultFont}" />
<Setter Property="FontWeight"
Value="SemiBold" />
<Setter Property="Background"
Value="{DynamicResource WhiteBrush}" />
<Setter Property="BorderBrush"
Value="{DynamicResource BlackBrush}" />
<Setter Property="Foreground"
Value="{DynamicResource TextBrush}" />
<Setter Property="Padding"
Value="5,6" />
<Setter Property="BorderThickness"
Value="1" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Button}">
<Grid>
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="CommonStates">
<VisualState x:Name="Normal" />
<VisualState x:Name="MouseOver">
<Storyboard>
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)"
Storyboard.TargetName="MouseOverBorder">
<EasingDoubleKeyFrame KeyTime="0"
Value="1" />
</DoubleAnimationUsingKeyFrames>
<ThicknessAnimationUsingKeyFrames Storyboard.TargetProperty="(Border.BorderThickness)"
Storyboard.TargetName="MouseOverBorder">
<EasingThicknessKeyFrame KeyTime="0"
Value="2" />
</ThicknessAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
<VisualState x:Name="Pressed">
<Storyboard>
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)"
Storyboard.TargetName="PressedBorder">
<EasingDoubleKeyFrame KeyTime="0"
Value="1" />
</DoubleAnimationUsingKeyFrames>
<ThicknessAnimationUsingKeyFrames Storyboard.TargetProperty="(Border.BorderThickness)"
Storyboard.TargetName="MouseOverBorder">
<EasingThicknessKeyFrame KeyTime="0"
Value="0" />
</ThicknessAnimationUsingKeyFrames>
<ThicknessAnimationUsingKeyFrames Storyboard.TargetProperty="(Border.BorderThickness)"
Storyboard.TargetName="PressedBorder">
<EasingThicknessKeyFrame KeyTime="0"
Value="2" />
</ThicknessAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
<VisualState x:Name="Disabled">
<Storyboard>
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="Opacity"
Storyboard.TargetName="DisabledVisualElement">
<SplineDoubleKeyFrame KeyTime="0"
Value="0.7" />
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)"
Storyboard.TargetName="contentPresenter">
<EasingDoubleKeyFrame KeyTime="0"
Value="0.3" />
</DoubleAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
</VisualStateGroup>
<VisualStateGroup x:Name="FocusStates">
<VisualState x:Name="Focused" />
<VisualState x:Name="Unfocused" />
</VisualStateGroup>
<VisualStateGroup x:Name="ValidationStates">
<VisualState x:Name="Valid" />
<VisualState x:Name="InvalidFocused" />
<VisualState x:Name="InvalidUnfocused" />
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<Border x:Name="Background"
BorderBrush="{DynamicResource BlackBrush}"
BorderThickness="2"
Background="{TemplateBinding Background}" />
<Rectangle x:Name="DisabledVisualElement"
Fill="{DynamicResource ControlsDisabledBrush}"
IsHitTestVisible="false"
Opacity="0" />
<Border x:Name="MouseOverBorder"
Background="{DynamicResource GrayBrush8}"
Opacity="0" />
<Border x:Name="PressedBorder"
Background="{DynamicResource BlackBrush}"
Opacity="0"
BorderBrush="{DynamicResource BlackBrush}" />
<ContentPresenter x:Name="contentPresenter"
ContentTemplate="{TemplateBinding ContentTemplate}"
Content="{TemplateBinding Content, Converter={StaticResource ToLowerConverter}}"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
Margin="{TemplateBinding Padding}"
RecognizesAccessKey="True"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
OpacityMask="{x:Null}" />
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver"
Value="True">
<Setter Property="Foreground"
Value="{DynamicResource BlackBrush}" />
</Trigger>
<Trigger Property="IsPressed"
Value="true">
<Setter Property="Foreground"
Value="{DynamicResource WhiteBrush}" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
最佳答案
我认为是这件作品 <Border x:Name="Background"
BorderBrush="{DynamicResource BlackBrush}"
BorderThickness="2"
Background="{TemplateBinding Background}" />
关于c# - 在 MahApps Metro 中覆盖 SqaureButton 样式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23615314/
有没有办法将 Dapper 包含在 Metro 应用程序中? 它依赖于 WinRT 中遗漏的 System.Data。 如果没有,是否有任何类似的框架可以使用? 最佳答案 Is there any w
我想为 Windows 8 Embedded Standard(发布预览版)创建一个自定义 shell(WinForms),允许用户运行、安装或更新应用程序(可以是桌面和/或 Metro 应用程序)。
我需要使用 c++ (WINRT/Metro) 在我的应用程序中生成唯一的临时文件名。如我所见,Win32 API GetTempFileName标记为仅在桌面上使用。 Metro 风格应用程序的等价
我想检索登录用户的用户名。是否可以?该应用程序仅用于内联网。 最佳答案 要将 Windows 身份验证添加到应用程序,请声明 'enterpriseAuthentication' capability
Metro UI 不支持多重绑定(bind)吗? 还是只是还没有添加? 最佳
我有公钥模数和公钥指数,我需要在 Metro 风格应用程序中生成公钥和加密数据。在 C# 中,我们有 RSAParameters 类,但我找不到任何适用于 Metro 风格应用程序的此类内容。 当我使
我从某人那里收到了一个项目,其中包括一个带有一些传感器和灯的 Arduino (Uno) 板,带有 USB 电缆以及用于通过 COM 端口与该板通信的文档化协议(protocol)。它适用于一些现有代
我正在尝试使用 Windbg 调试 C++ Metro 应用程序。由于 Windbg 在桌面上执行,应用程序在调试 session 5 秒后暂停,我必须切换回 Metro Desktop 以恢复应用程
任何人都可以建议我如何在 MahApps Metro 布局中实现图 block 的拖放。谢谢.. 最佳答案 我们使用 punker76 的另一个库取得了成功。 它轻量级且易于实现! GitHub ht
我想为我的 Android 应用程序设计 Metro 风格的 UI。怎么做?有什么捷径吗?我尝试使用 ImageView 制作一个。如何为其赋予效果?还有其他方法吗?请帮助我.... 最佳答案 试试
我看到 Metro 应用已更名为“Windows 8 应用”或“Windows 应用商店应用”。 是否有独立于通过其商店发布的工作流程的全屏应用程序风格的术语?你能构建一个可以直接安装的 Window
我正在开发一个应用程序,它将一些文件下载到本地存储进行缓存。在线文件有时位于 3 或 4 个嵌套文件夹中,我也想将此层次结构保留在我的缓存文件夹中。 除了 (await (await folder.G
我正在开发一个 Office 加载项,并想添加一个 WPF Mahapps Windows。 一切顺利,但我无法应用 Mahapps Windows 样式。 看教程here我看到我更新了 App.xa
我正在开发一个 Office 加载项,并想添加一个 WPF Mahapps Windows。 一切顺利,但我无法应用 Mahapps Windows 样式。 看教程here我看到我更新了 App.xa
如何获取Windows应用商店应用(Metro应用)中的唯一设备? 我们可以使用: Windows.System.Profile.HardwareIdentification.GetPackageSp
我正在执行 http GET 来获取数据,我正在使用 IXMLHTTPRequest2。 如果我 GET url "http://foo.com"(curl "http://foo.com") ,第二
我正在使用 Javascript 和 HTML 构建 Windows Metro 应用程序,但它崩溃了 HierarchyRequestError : Exception was thrown but
我正在创建一个简单的 metro 应用程序。我也在创建同一个应用的非 Metro 版本。 我面临的问题是 VS 不允许我将普通类库引用到 Metro 应用程序中,也不允许我将 Metro 类库引用到普
我正在尝试捆绑 markdown 文件而不产生太多开销(即不将它们手动添加到 Xcode 和 Android Studio 中的 Assets 包,不使用第 3 方依赖项)。 我的想法是允许 requ
能否在 Windows 8 上基于 C# XAML 的 Metro 应用程序中嵌入 IE Web 浏览器控件?另外,这样做时 HTML/Javascript 是否可以拥有 Windows 8 HTML
我是一名优秀的程序员,十分优秀!