Windows Phone 8:删除数据透视表头 [英] Windows Phone 8: remove pivot header

查看:125
本文介绍了Windows Phone 8:删除数据透视表头的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在枢轴控件的样式方面遇到了一个奇怪的问题. 我要在Expression Blend中编辑默认模板的副本,因为我想删除整个标头.

I have got a strange problem with the styling of my pivot control. I edited a copy of the default template in Expression Blend because I want to remove the entire header.

改编的样式:

<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)'访问冲突'".

My thought was just to remove or set the visibility of <Primitives:PivotHeadersControl> to collapsed but then my app crashes without any exception and the following message in my output window: "The program '[2332] TaskHost.exe' has exited with code -1073741819 (0xc0000005) 'Access violation'" appears.

我阅读了一些文章,以使数据透视表向上移动,以便页眉不在屏幕上,但是我需要在页面底部使用自定义的数据透视表,并在其上方添加一些其他控件.

I read some posts to move up the pivot so that the header is out of the screen but I need my customized pivot at the bottom of my page with some other controls above it.

有人知道如何删除标题吗?

Does anybody have an idea how to remove the header?

为清楚起见,我想删除标题和标题.

For clarity I want to remove title and header.

推荐答案

因此,在Windows Phone 8上删除标头和标题不再起作用. 因此,我从以下位置移植了一个现有控件: http://www.codeproject.com/Articles/136786/Creating-an-Animated-ContentControl 到Windows Phone 8.

So removing the header AND the title doesn't work anymore on Windows Phone 8. So I ported an existing control from: http://www.codeproject.com/Articles/136786/Creating-an-Animated-ContentControl to Windows Phone 8.

这篇关于Windows Phone 8:删除数据透视表头的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆