Conclusion from UserControl to Silverlight

In Silverlight 2, I have the following class declaration for a control:

public partial class ClassX : UserControl

I want to replace UserControl with ClassXBase, which comes from UserControl, but I get a reasonable error. "Partial ClassX declarations must not indicate different base classes"

However, I cannot find another partial class to replace its base class. Any idea where this other partial class is or how do I do it?

+3
source share
2 answers

If you include the namespace of your base class UserControl, you can do this as long as you use the namespace. For example:

public abstract class MyBaseUserControl : UserControl
{
  // ...
} 

XAML ( , ):

<!-- Page.xaml -->
<my:BaseUserControl 
    x:Class="SilverlightApplication11.Page"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    xmlns:my="clr-namespace:SilverlightApplication11"
    Width="400" Height="300">
    <Grid x:Name="LayoutRoot" Background="White">

    </Grid>
</my:BaseUserControl>

, :

public partial class Page : BaseUserControl
{
  public Page()
  {
    InitializeComponent();
  }
}
+12

UserControl XAML, , UserControl. ? , , . , , . , , ContentControl Control. Silverlight.net.

+3

All Articles