2010-04-07 28 views
0

我想爲我的一些UserControls創建一個自定義基類。 在VS2008中這樣做很好,並按預期進行編譯,但是當我在Blend 3中編輯控件時,blabla.g.vb中的基類總是變回System.Windows.Controls.UserControl。在Silverlight 3中使用Blend控制繼承性

我該如何強制Blend保留指定的基類?

問候 克里斯托夫

回答

1

你能告訴你的XAML?

我懷疑的情況下是你的XAML是這樣的:

<UserControl xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
      xmlns:local="clr-namespace:SilverlightApplication15" 
      x:Class="SilverlightApplication15.MainPage" 
      Width="640" 
      Height="480"> 

    <Grid x:Name="LayoutRoot" 
      Background="#FF313131" /> 
</UserControl> 

當它應該是這樣的:

<local:BlahBlah xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
       xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
       xmlns:local="clr-namespace:SilverlightApplication15" 
       x:Class="SilverlightApplication15.MainPage" 
       Width="640" 
       Height="480"> 

    <Grid x:Name="LayoutRoot" 
      Background="#FF313131" /> 
</local:BlahBlah> 

,所以它不是從XAML生成的.g.vb文件你應該直接編輯一個文件。

+0

它工作!非常感謝你! – Christoph 2010-04-07 15:58:31