2013-05-20 29 views
0

我生成菜單項動態,以下是我的菜單WPF菜單

<ItemsControl x:Name="MainToolbar" 
       cal:RegionManager.RegionName="{x:Static inf:RegionNames.MainToolBarRegion}" 
       HorizontalAlignment="Stretch" 
       VerticalAlignment="Top" 
       Margin="0,10,841,0" 
       RenderTransformOrigin="-0.133,-5.917" 
       Height="28" 
       Width="35"> 
    <ItemsControl.RenderTransform> 
    <TransformGroup> 
     <ScaleTransform /> 
     <SkewTransform /> 
     <RotateTransform /> 
     <TranslateTransform /> 
    </TransformGroup> 
    </ItemsControl.RenderTransform> 
    <Menu IsMainMenu="True" 
     Margin="0,0,0,0" 
     Height="28" 
     ItemsSource="{Binding Path=Menu}" 
     Width="400"> 
    <Menu.Resources> 
     <Style x:Key="ThemeMenuItemStyle" 
      TargetType="MenuItem" 
      BasedOn="{StaticResource KV_MenuItem}"> 
     <Setter Property="Header" 
       Value="{Binding Path=Text}"></Setter> 
     <Setter Property="Command" 
       Value="{Binding Path=Command}" /> 
     <Setter Property="IsCheckable" 
       Value="True" /> 
     <Setter Property="MinWidth" 
       Value="80" /> 
     </Style> 
    </Menu.Resources> 
    </Menu> 
</ItemsControl> 

我的菜單項添加到菜單正確(從我的另一個服務)

這裏的問題是我生成的視圖顯示不正確,意味着我只能看到一個小框,休息視圖被剪掉。 (它不會擴展到其內容)。我怎樣才能看到我的完整菜單顯示?

enter image description here

回答

1

在你的ItemsControl聲明中刪除寬度聲明和可能的保證金爲好。這些屬性可能會限制您的視圖。

+0

謝謝。從此發生了一段時間 – kuhajeyan