我的透视控件的样式有一个奇怪的问题。 我在Expression Blend中编辑了一个默认模板的副本,因为我想删除整个标题。Windows Phone 8:删除数据透视表标头
的改编风格:
<Style x:Key="PivotWithoutHeader" TargetType="phone:Pivot">
<Setter Property="Margin" Value="0"/>
<Setter Property="Padding" Value="0"/>
<Setter Property="Foreground" Value="{StaticResource PhoneForegroundBrush}"/>
<Setter Property="Background" Value="Transparent"/>
<Setter Property="ItemsPanel">
<Setter.Value>
<ItemsPanelTemplate>
<Grid/>
</ItemsPanelTemplate>
</Setter.Value>
</Setter>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="phone:Pivot">
<Grid HorizontalAlignment="{TemplateBinding HorizontalAlignment}" VerticalAlignment="{TemplateBinding VerticalAlignment}">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Grid Background="{TemplateBinding Background}" Grid.RowSpan="3"/>
<!--<ContentControl ContentTemplate="{TemplateBinding TitleTemplate}" Content="{TemplateBinding Title}" HorizontalAlignment="Left" Margin="24,17,0,-7" Style="{StaticResource PivotTitleStyle}"/>-->
<Primitives:PivotHeadersControl x:Name="HeadersListElement" Grid.Row="1"/>
<ItemsPresenter x:Name="PivotItemPresenter" Margin="{TemplateBinding Padding}" Grid.Row="2"/>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
和我的风格用法:
<phone:Pivot Grid.Row="1" x:Name="Objects" ItemsSource="{Binding Profiles}"
Style="{StaticResource PivotWithoutHeader}">
<phone:Pivot.ItemContainerStyle>
<Style TargetType="phone:PivotItem">
<Setter Property="HorizontalAlignment" Value="Stretch" />
</Style>
</phone:Pivot.ItemContainerStyle>
<phone:Pivot.ItemTemplate>
<DataTemplate>
<Grid>
<Image Source="Resources/homer.png"/>
<TextBlock Text="{Binding Name}"/>
<TextBlock Text="#Sample" />
<Button Margin="347,0,0,0" Command="{Binding DataContext.SettingsCommand, ElementName=Objects}" CommandParameter="{Binding .}" />
</Grid>
</DataTemplate>
</phone:Pivot.ItemTemplate>
</phone:Pivot>
我的想法是只删除或<Primitives:PivotHeadersControl>
的可见性设置为崩溃,但后来我的应用程序崩溃,没有任何异常并在我的输出窗口中显示以下消息:“程序'[2332] TaskHost.exe'已退出,代码为-1073741819(0xc0000005)'访问冲突'”出现。
我看了一些帖子,这样的头是在屏幕的向上移动枢轴,但我需要我的个性支点在我的网页与它上面的一些其他控件的底部。
有没有人有一个想法如何删除标题?
编辑:为了清楚我想删除标题和标题。
你找出如何做到这一点? – halileohalilei
某种。请看标记的答案。 – Danscho