2011-05-18 98 views
2

我不得不使用一個TabControl有棱鏡視圖:TabControlRegionAdapter的Silverlight 5 +棱鏡:TabControlRegionAdapter

<sdk:TabControl Grid.Row="1" AutomationProperties.AutomationId="GUID" Margin="8,8,12,12" 
        prism:RegionManager.RegionName="GUID_REG_NAME" 
        prism:RegionManager.RegionContext="{Binding CurrentSelectedItem}" Name="TabControl1" > 
     <prism:TabControlRegionAdapter.ItemContainerStyle> 
      <Style TargetType="sdk:TabItem"> 
       <Setter Property="HeaderTemplate"> 
        <Setter.Value> 
         <!--Display the child view name on the tab header--> 
         <DataTemplate> 
          <TextBlock Text="{Binding ViewName}" /> 
         </DataTemplate> 
        </Setter.Value> 
       </Setter> 
      </Style> 
     </prism:TabControlRegionAdapter.ItemContainerStyle> 
    </sdk:TabControl> 

一切工作正常,只要我有針對性的Silverlight 4

我拿到的Silverlight 5 Beta版和改變了項目的目標版本SL 5
現在的觀點不會錯誤編譯:
The property 'ItemContainerStyle' does not exist on the type 'TabControl' in the XML namespace 'http://www.codeplex.com/prism'

任意子否則有這個錯誤?
有關原因的任何想法/如何解決它?

+0

你有沒有解決這個問題? – 2012-04-02 21:27:36

+0

我沒有時間再看看這個:(如果以下任何回答都是正確的,請留下評論,我將接受 – Ando 2012-04-11 13:45:11

+0

您是否已將SDK參考更新爲5.0? – 2011-05-26 02:55:13

回答

2

我有同樣的問題。我把標籤風格融入XAML的資源部分,並用下面的代碼隱藏:

當加入
TabControlRegionAdapter.SetItemContainerStyle(TabControl1, Resources["TabControl1ItemStyle"] as Style);