0
在Flash中,可以指向磁盘上的文件以将表单与类名称可以不同于表单名称的类相关联,以便可以将多个表单到同一班。是否有可能将相同的代码隐藏与闪存中的多个类在silverlight中关联
在Silverlight中是否有可能以某种方式包括通过手动攻击vs studio项目xml文件?
在Flash中,可以指向磁盘上的文件以将表单与类名称可以不同于表单名称的类相关联,以便可以将多个表单到同一班。是否有可能将相同的代码隐藏与闪存中的多个类在silverlight中关联
在Silverlight中是否有可能以某种方式包括通过手动攻击vs studio项目xml文件?
它使用继承来执行。您可以在基本控件中定义所有需要的内容,并且派生控件使用此代码。比如你要定义事件处理程序,将被用于所有控件:
定义在基类的事件处理程序 - BaseControl.xaml.cs
namespace SilverlightApp
{
public partial class BaseControl : UserControl
{
public BaseControl()
{
InitializeComponent();
}
// The event handler that used by derived classes
protected void Button_Click(object sender, RoutedEventArgs e)
{
// your implementation here
}
}
}
BaseControl.xaml
<UserControl x:Class="SilverlightApp.BaseControl"
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"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="400">
<!-- your implementation here if needed -->
</UserControl>
MyControl1.xaml.cs - 定义从BaseControl继承的新控件。你只需要指定基类
namespace SilverlightApp
{
public partial class MyControl1 : BaseControl
{
public MyControl1()
{
InitializeComponent();
}
}
}
MyControl1.xaml
<local:BaseControl x:Class="SilverlightApp.MyControl1"
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:local="clr-namespace:SilverlightApp"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="400">
<Grid x:Name="LayoutRoot" Background="White">
<!-- button uses event handler from the base class -->
<Button Content="My button" Click="Button_Click" />
</Grid>
</local:BaseControl>
希望它你是什么意思。
非常感谢你会尝试。 – user310291 2011-04-27 20:52:42