kuhajeyan
kuhajeyan

Reputation: 11017

WPF menu not shown in proper view

I am generating menu items dynamically, following is my menu

<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>

My menu items added to the menu correctly (from my another service)

The problem here is my generated view not showing properly, means i can only see a small box where rest view is clipped off. (it does not expand to its contents). how can i see my full menu shown?

enter image description here

Upvotes: 0

Views: 93

Answers (1)

Kristian K.
Kristian K.

Reputation: 1515

In your ItemsControl declaration remove the Width declaration and possible the Margin as well. Those properties maybe restricting your view.

Upvotes: 1

Related Questions