【发布时间】:2012-03-09 15:56:56
【问题描述】:
我有以下用户控件
<UserControl
x:Class="MyUserControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
mc:Ignorable="d">
<Grid>
<Label Content="Label"
Name="myLabel" />
</Grid>
</UserControl>
我需要:
1) 公开myLabel 的FontFamily 属性,因为它是MyUserControl 的属性。
2) *(真正的可选)定义 myLabel 内容为“MyUserControl1”、“MyUserControl2”等,就像添加多个控件时设计器所做的那样。
我应该如何公开该属性,例如序数属性(?)或依赖项(?)...
【问题讨论】:
标签: .net wpf xaml wpf-controls