我已經在用戶控件曝光對象的內部屬性在WPF
<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」等,就像設計者在添加多個控件時所做的那樣。
我應該怎樣暴露那麼該屬性,就像一個序屬性(?)或依賴一個(?)...
第二個問題。假設你在設計器中添加了一個標籤。名稱和文本是「Label1」...現在,你把另一個,名稱和文本將是「Label2」等。我需要我的標籤的文本行爲在相同的邏輯。 – serhio 2012-03-09 16:57:01
shit ...已在UserControl中聲明的FontFamily – serhio 2012-03-09 17:22:36