請檢查以下圖像以獲取有關我的問題的參考。如何在Windows Phone 8中的數據透視表頭中添加圖像和按鈕
我想實現在PIVOT頭一個公司標誌與signout按鈕。
以與上述鏈接相同的方式,即Bank Of America windows phone app。
我剛接觸windows phone 8應用程序開發。
任何解決方案/指導/實施這一概念的幫助將不勝感激。
請檢查以下圖像以獲取有關我的問題的參考。如何在Windows Phone 8中的數據透視表頭中添加圖像和按鈕
我想實現在PIVOT頭一個公司標誌與signout按鈕。
以與上述鏈接相同的方式,即Bank Of America windows phone app。
我剛接觸windows phone 8應用程序開發。
任何解決方案/指導/實施這一概念的幫助將不勝感激。
更新1
在頂部<phone:PhoneApplicationPage ... />
您需要創建自定義樣式Pivot
因爲Pivot
的標題需要滿足的條件是第一和第三列定義必須添加xmlns:Primitives="clr-namespace:Microsoft.Phone.Controls.Primitives;assembly=Microsoft.Phone"
: WIDTH = 「自動」。您無法直接像這樣分配UI元素。
<phone:Pivot>
<phone:Pivot.Title>
<!-- XAML Elements -->
</phone:Pivot.Title>
<phone:PivotItem>
.....
</phone:Pivot>
試試下面的代碼。
<phone:PhoneApplicationPage.Resources>
<Style x:Key="PivotStyle1" 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"/>
<Grid Background="#d60019" Height="50">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<TextBlock
HorizontalAlignment="Left"
Margin="12,0,0,0"
Foreground="White"
FontSize="20"
VerticalAlignment="Center"
Text="Bank of America"
Tap="TextBlock_Tap_1"/>
<ContentControl
ContentTemplate="{TemplateBinding TitleTemplate}"
Content="{TemplateBinding Title}"
Grid.Column="1"
HorizontalAlignment="Left"
Margin="0,0,0,-7"
VerticalAlignment="Center"
Style="{StaticResource PivotTitleStyle}"/>
<TextBlock
Foreground="White"
FontSize="20"
Margin="0,0,10,0"
Grid.Column="2"
HorizontalAlignment="Right"
VerticalAlignment="Center"
Text="sign out" />
</Grid>
<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:PhoneApplicationPage.Resources>
<Grid x:Name="LayoutRoot">
<phone:Pivot
Title=""
Style="{StaticResource PivotStyle1}">
<phone:PivotItem
Header="accounts" />
<phone:PivotItem
Header="deals" />
</phone:Pivot>
</Grid>
我想,它不在pivot的頭部,它是空的。圖像&簽名似乎在頂部的網格內。 – Xyroid