{
public partial class SelectToMonth : UserControl
{
#region select title property
public static readonly DependencyProperty SelectTitleProperty =
DependencyProperty.Register("SelectTitle", typeof(String), typeof(SelectToMonth), null);//這塊是類型
public string SelectTitle
{
get { return (string)GetValue(SelectTitleProperty); }
set
{
SetValue(SelectTitleProperty, value);
}
}
#endregion
<UserControl x:Class="OSSDOM.DataQuality.CommonSL.Control.SelectToMonth"
xmlns=" xmlns:x=" xmlns:d=" xmlns:mc=" mc:Ignorable="d"
d:DesignHeight="27" d:DesignWidth="220" x:Name="userControl">
<Grid x:Name="LayoutRoot" Background="White">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="60"/>
<ColumnDefinition Width="63"/>
<ColumnDefinition Width="15"/>
<ColumnDefinition Width="64"/>
<ColumnDefinition Width="15*"/>
</Grid.ColumnDefinitions>
<TextBlock Height="20" Margin="2,3,1,0" Name="title" HorizontalAlignment="Stretch" VerticalAlignment="Top" Text="{Binding SelectTitle, ElementName=userControl}" /> //這塊是控件名稱userControl
<my:SelectToMonth Grid.Row="1" x:Name="結束時間" SelectTitle="結束時間" />