我有使用用户控件生成 gridview 的代码:
<ListView x:Name="ListView" SelectionMode="None">
<ListView.ItemTemplate>
<DataTemplate>
<Grid>
<UserControls:ItemTemplateControl Parametr="XXXXXXX"/>
</Grid>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
Listview 工作正常,但我无法向我的 UserControl 发送任何内容。用户控制代码:
public sealed partial class ItemTemplateControl : UserControl
{
public string Parametr
{
get
{
return (string)GetValue(ParametrProperty);
}
set
{
SetValue(ParametrProperty, value);
}
}
public static DependencyProperty ParametrProperty = DependencyProperty.Register("Parametr", typeof(string), typeof(ItemTemplateControl), new PropertyMetadata(""));
public ItemTemplateControl()
{
this.InitializeComponent();
post_text.Text = Parametr;
Get();
}
此代码不起作用!我现在不知道问题出在哪里?
对不起我的英语不好
<Page
x:Class="App13.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:App13"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:UserControls="using:App13.UserControls"
mc:Ignorable="d">