解決方案是如此簡單,只需添加填充到
DetailsCommandBar
和
MasterCommandBar
這裏的一部分我的cu stom.xaml文件:
<Style TargetType="localControls:MasterDetailsView">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="localControls:MasterDetailsView">
<Border
x:Name="ControlRoot"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}">
<Grid>
<Grid.RowDefinitions>
<RowDefinition x:Name="CommandBarRow" Height="Auto" />
<RowDefinition x:Name="ContentRow" Height="*" />
<RowDefinition x:Name="MobileCommandBarRow" Height="0" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition x:Name="MasterPane" Width="{Binding MasterPaneWidth, RelativeSource={RelativeSource TemplatedParent}}" />
<ColumnDefinition x:Name="DetailsPane" Width="*" />
</Grid.ColumnDefinitions>
<CommandBar
x:Name="DetailsCommandBar"
Grid.Row="0"
Grid.Column="1"
Padding="48,0,0,0">
<CommandBar.Content>
</CommandBar.Content>
</CommandBar>
<CommandBar
x:Name="MasterCommandBar"
Grid.Row="0"
Grid.Column="0"
Padding="48,0,0,0">
<CommandBar.Content>
</CommandBar.Content>
</CommandBar>
</Grid>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>