I've got this bit of code in one of my control templates for a SplitButton I'm working on:
<Popup x:Name="PART_Popup"
AllowsTransparency="True"
Grid.Row="1"
IsOpen="{Binding Path=IsDropDownOpen, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}"
Placement="Bottom"
PopupAnimation="{DynamicResource {x:Static SystemParameters.ComboBoxPopupAnimationKey}}"
StaysOpen="False"
MinWidth="{Binding Path=ActualWidth, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type wpfcustomcontrols:SplitButton}}}">
<mwt:SystemDropShadowChrome Color="Transparent">
<Border x:Name="DropDownBorder"
Background="{DynamicResource {x:Static SystemColors.WindowBrushKey}}"
BorderBrush="{DynamicResource {x:Static SystemColors.WindowFrameBrushKey}}"
BorderThickness="1">
<ItemsPresenter KeyboardNavigation.DirectionalNavigation="Contained"
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
</Border>
</mwt:SystemDropShadowChrome>
</Popup>
The problem is the items within the ItemsPresenter (which are MenuItems) keep centering their content. I'm trying to figure out how to left-align their content instead... I have even tried doing something like this for the menuitems themselves:
<MenuItem>
<MenuItem.Header>
<TextBlock HorizontalAlignment="Left"
Text="Item 1" />
</MenuItem.Header>
</MenuItem>
But, still the items center their content. What am I missing?