C# XAML中带参数的UserControl(Win Store应用程序)
我需要向我的用户控件发送参数。我现在知道如何实现发送,但不知道如何获取此参数 我的代码:C# XAML中带参数的UserControl(Win Store应用程序),c#,xaml,windows-store-apps,C#,Xaml,Windows Store Apps,我需要向我的用户控件发送参数。我现在知道如何实现发送,但不知道如何获取此参数 我的代码: <UserControls:ItemTemplateControl Parameter="23"/> 提前谢谢 转到UserControl的代码隐藏,并使用属性: public class ItemTemplateControl : UserControl { int _parameter; public int Parameter { ge
<UserControls:ItemTemplateControl Parameter="23"/>
提前谢谢 转到
UserControl
的代码隐藏,并使用属性:
public class ItemTemplateControl : UserControl
{
int _parameter;
public int Parameter
{
get
{
return _parameter;
}
set
{
// do something with the given value
_parameter = value; // set _parameter to the given value
}
}
// your other UserControl code here
}
有关C#属性的更多信息: