【发布时间】:2010-09-28 09:03:04
【问题描述】:
我有这段代码:
CustomUserControl.xaml.cs
namespace MyProject
{
public partial class CustomUserControl<T> : UserControl
{
...
}
}
还有这个 xaml:
CustomUserControl.xaml
<UserControl x:Class="MyProject.CustomUserControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:sys="clr-namespace:System;assembly=mscorlib">
<Grid>
</Grid>
它不起作用,因为 x:Class="MyProject.CustomUserControl" 与代码隐藏的通用类定义不匹配。有什么方法可以让这个工作吗?
【问题讨论】: