如何在以下CSS内容属性中插入Google Material Icon"chevron icon right"(https://design.google.com/icons/#ic_chevron_right):
.bullet li a:before {
content: "";
}
Run Code Online (Sandbox Code Playgroud) css css3 contentproperty material-design google-material-icons
每次我写出一个其Value内存属性值不可内联的setter时,我都会诅咒API没有标记Setter该类的事实[ContentProperty("Value")],这将允许:
<Setter Property="BitmapEffect">
<Setter.Value>
<OuterGlowBitmapEffect GlowColor="#AAC" Opacity="0.2" GlowSize="1.25" />
</Setter.Value>
</Setter>
Run Code Online (Sandbox Code Playgroud)
......简化为:
<Setter Property="BitmapEffect">
<OuterGlowBitmapEffect GlowColor="#AAC" Opacity="0.2" GlowSize="1.25" />
</Setter>
Run Code Online (Sandbox Code Playgroud)
所以我的问题有点双重.首先,有没有一个很好的理由没有以这种方式配置API?其次,XamlReader即使我不控制WPF API ,有什么能阻止我以某种方式提供这些元数据吗?
这是我拥有的C#模板代码:
public class PopupFrame : Frame
{
public PopupFrame()
{
this.SetDynamicResource(BackgroundColorProperty, "PopUpBackgroundColor");
this.SetDynamicResource(CornerRadiusProperty, "PopupCornerRadius");
HasShadow = true;
HorizontalOptions = LayoutOptions.FillAndExpand;
Padding = 0;
VerticalOptions = LayoutOptions.Center;
}
}
Run Code Online (Sandbox Code Playgroud)
我是这样使用它的:
<t:PopupFrame>
<StackLayout HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand">
<t:PopupHeader Text="Copy Deck" />
<t:PopupEntryHeader Text="New Deck Name" />
More XAML here
</StackLayout>
</t:PopupFrame>
Run Code Online (Sandbox Code Playgroud)
有什么方法可以编码,PopupFrame以便它StackLayout是它的一部分并且它需要内容。
这是我想编码的内容:
<t:PopupFrame>
<t:PopupHeader Text="Copy Deck" />
<t:PopupEntryHeader Text="New Deck Name" />
More XAML here
</t:PopupFrame>
Run Code Online (Sandbox Code Playgroud) 以下XAML(下面)定义了资源中的自定义集合,并尝试使用自定义对象填充它;
<UserControl x:Class="ImageListView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Width="300" Height="300"
xmlns:local="clr-namespace:MyControls" >
<UserControl.Resources>
<local:MyCustomCollection x:Key="MyKey">
<local:MyCustomItem>
</local:MyCustomItem>
</local:MyCustomCollection>
</UserControl.Resources>
</UserControl>
Run Code Online (Sandbox Code Playgroud)
问题是我在'类型'的设计者中遇到错误.MyCustomCollection'不支持直接内容'.我已经尝试在MSDN中建议设置ContentProperty,但无法弄清楚要将其设置为什么.我使用的自定义集合对象如下,非常简单.我已经尝试了Item,Items和MyCustomItem,并且无法想到还有什么可以尝试.
<ContentProperty("WhatGoesHere?")> _
Public Class MyCustomCollection
Inherits ObservableCollection(Of MyCustomItem)
End Class
Run Code Online (Sandbox Code Playgroud)
我将非常感激地收到关于我出错的任何线索.还提示如何深入了解WPF对象模型以查看在运行时公开的属性,我也可以通过这种方式来理解它.
问候
瑞安