【发布时间】:2011-02-28 16:44:20
【问题描述】:
我已经成功创建了这样的 wpf 用户控件继承:
<base:BaseUserControl x:Class="wpfcontrolinheritance.InheritedUserControl"
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"
xmlns:base="clr-namespace:Base;assembly=Base"
mc:Ignorable="d"
d:DesignHeight="128" d:DesignWidth="238">
<Grid>
<Slider Height="23" HorizontalAlignment="Left" Margin="67,52,0,0" Name="slider1" VerticalAlignment="Top" Width="100" />
</Grid>
</base:BaseUserControl>
我尝试对 silverlight 做同样的事情,但它不起作用。它说找不到 BaseSilverlight,而我确实将 BaseSilverlight 项目添加到了引用中。
<BaseSilverlight:BaseSilverlight x:Class="silverlightcontrolinheritance.inheritedusercontrol"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:base="clr-namespace:BaseSilverlight;assembly=BaseSilverlight"
mc:Ignorable="d"
d:DesignHeight="149" d:DesignWidth="318">
<Grid x:Name="LayoutRoot" Background="White">
</Grid>
</BaseSilverlight:BaseSilverlight>
using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
namespace BaseSilverlight
{
public class BaseSilverlight
{
}
}
没有人真的知道吗?我认为这是一个基本问题。
【问题讨论】:
标签: c# .net wpf silverlight xaml