无法将按钮添加到中心页面模板
Can't add a button to the hubpage Template
如何将按钮或其他视觉样式元素添加到 Windows Phone 8.1 中默认主页模板的一个 hubsection?
我想在我的 ListView 上方添加一个刷新按钮。
<Hub x:Name="Hub" x:Uid="Hub" Header="BuLi Tweet" Foreground="White" Background="{StaticResource RasenHintergrund}">
<HubSection x:Uid="HubSection1" Header="Aktueller Spieltag" Width="400"
DataContext="{Binding Groups[0]}" HeaderTemplate="{ThemeResource HubSectionHeaderTemplate}">
<DataTemplate>
<ListView
ContinuumNavigationTransitionInfo.ExitElementContainer="True">
<GridView
Margin="5,0,0,0"
ItemsSource="{Binding Items}"
AutomationProperties.AutomationId="ItemGridView"
AutomationProperties.Name="Items In Group"
ItemTemplate="{StaticResource MatchIcon}"
SelectionMode="None"
IsItemClickEnabled="True"
ScrollViewer.VerticalScrollBarVisibility="Auto"
ScrollViewer.VerticalScrollMode="Enabled"
ItemClick="ItemView_ItemClick"
ContinuumNavigationTransitionInfo.ExitElementContainer="True">
<GridView.ItemsPanel>
<ItemsPanelTemplate>
<VariableSizedWrapGrid Orientation="Horizontal" />
</ItemsPanelTemplate>
</GridView.ItemsPanel>
</GridView>
</ListView>
</DataTemplate>
</HubSection>
我希望您希望按钮位于列表视图之前的第一个中心部分内。只需添加网格并为网格定义 RowDefinations
<HubSection x:Uid="HubSection1" Header="Aktueller Spieltag" Width="400"
DataContext="{Binding Groups[0]}" HeaderTemplate="{ThemeResource HubSectionHeaderTemplate}">
<DataTemplate>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Button Content="Refresh" Visibility="{Binding}"/>
<ListView Grid.Row="1"
ContinuumNavigationTransitionInfo.ExitElementContainer="True">
<GridView
Margin="5,0,0,0"
ItemsSource="{Binding Items}"
AutomationProperties.AutomationId="ItemGridView"
AutomationProperties.Name="Items In Group"
ItemTemplate="{StaticResource MatchIcon}"
SelectionMode="None"
IsItemClickEnabled="True"
ScrollViewer.VerticalScrollBarVisibility="Auto"
ScrollViewer.VerticalScrollMode="Enabled"
ItemClick="ItemView_ItemClick"
ContinuumNavigationTransitionInfo.ExitElementContainer="True">
<GridView.ItemsPanel>
<ItemsPanelTemplate>
<VariableSizedWrapGrid Orientation="Horizontal" />
</ItemsPanelTemplate>
</GridView.ItemsPanel>
</GridView>
</ListView>
</Grid>
</DataTemplate>
</HubSection>
如何将按钮或其他视觉样式元素添加到 Windows Phone 8.1 中默认主页模板的一个 hubsection?
我想在我的 ListView 上方添加一个刷新按钮。
<Hub x:Name="Hub" x:Uid="Hub" Header="BuLi Tweet" Foreground="White" Background="{StaticResource RasenHintergrund}">
<HubSection x:Uid="HubSection1" Header="Aktueller Spieltag" Width="400"
DataContext="{Binding Groups[0]}" HeaderTemplate="{ThemeResource HubSectionHeaderTemplate}">
<DataTemplate>
<ListView
ContinuumNavigationTransitionInfo.ExitElementContainer="True">
<GridView
Margin="5,0,0,0"
ItemsSource="{Binding Items}"
AutomationProperties.AutomationId="ItemGridView"
AutomationProperties.Name="Items In Group"
ItemTemplate="{StaticResource MatchIcon}"
SelectionMode="None"
IsItemClickEnabled="True"
ScrollViewer.VerticalScrollBarVisibility="Auto"
ScrollViewer.VerticalScrollMode="Enabled"
ItemClick="ItemView_ItemClick"
ContinuumNavigationTransitionInfo.ExitElementContainer="True">
<GridView.ItemsPanel>
<ItemsPanelTemplate>
<VariableSizedWrapGrid Orientation="Horizontal" />
</ItemsPanelTemplate>
</GridView.ItemsPanel>
</GridView>
</ListView>
</DataTemplate>
</HubSection>
我希望您希望按钮位于列表视图之前的第一个中心部分内。只需添加网格并为网格定义 RowDefinations
<HubSection x:Uid="HubSection1" Header="Aktueller Spieltag" Width="400"
DataContext="{Binding Groups[0]}" HeaderTemplate="{ThemeResource HubSectionHeaderTemplate}">
<DataTemplate>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Button Content="Refresh" Visibility="{Binding}"/>
<ListView Grid.Row="1"
ContinuumNavigationTransitionInfo.ExitElementContainer="True">
<GridView
Margin="5,0,0,0"
ItemsSource="{Binding Items}"
AutomationProperties.AutomationId="ItemGridView"
AutomationProperties.Name="Items In Group"
ItemTemplate="{StaticResource MatchIcon}"
SelectionMode="None"
IsItemClickEnabled="True"
ScrollViewer.VerticalScrollBarVisibility="Auto"
ScrollViewer.VerticalScrollMode="Enabled"
ItemClick="ItemView_ItemClick"
ContinuumNavigationTransitionInfo.ExitElementContainer="True">
<GridView.ItemsPanel>
<ItemsPanelTemplate>
<VariableSizedWrapGrid Orientation="Horizontal" />
</ItemsPanelTemplate>
</GridView.ItemsPanel>
</GridView>
</ListView>
</Grid>
</DataTemplate>
</HubSection>