頁面的代碼如下:
<Page
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:voteme"
DataContext="{Binding Participants, RelativeSource={RelativeSource Self}}"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:navigation="using:Syncfusion.UI.Xaml.Controls.Navigation"
xmlns:input="using:Syncfusion.UI.Xaml.Controls.Input"
x:Class="voteme.RateAll"
mc:Ignorable="d">
<Grid Style="{StaticResource LayoutRootStyle}">
<Grid.RowDefinitions>
<RowDefinition Height="140"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<!-- Back button and page title -->
<Grid Background="#FF939D46">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Button x:Name="backButton" Style="{StaticResource BackButtonLightStyle}" Margin="36"
VerticalAlignment="Top" Click="backButton_Click"/>
<StackPanel>
<TextBlock x:Name="pageTitle" Foreground="White" Grid.Column="1" Text="{StaticResource AppName}"
Style="{StaticResource PageHeaderTextStyle}" Margin="120 38" VerticalAlignment="Top"/>
</StackPanel>
</Grid>
<Grid Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="300"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Grid Grid.Column="1" Background="#FFEDEDEB" />
<navigation:SfTabControl TabStripPlacement="Left" Margin="0 60"
Grid.ColumnSpan="2" HorizontalAlignment="Stretch"
x:Name="ParticipantsList"
DisplayMemberPath="FullName">
<navigation:SfTabItem>
<TextBlock Text="{Binding Position}" Style="{StaticResource HeaderTextStyle}" VerticalAlignment="Top"/>
</navigation:SfTabItem>
</navigation:SfTabControl>
</Grid>
</Grid>
類代碼(與TabContent和TabItem的)是這樣的:
public List<ParticipantRatesView> Participants = new List<ParticipantRatesView>();
foreach (var participant in _persons)
{
Participants.Add(
new ParticipantRatesView()
{
FullName = participant.FullName,
Position = participant.Position,
Email = participant.Email,
PersonId = participant.Id,
AverageRate = participant.TotalRate,
OfficeRate = ((Rates) _ratesAll.CurrentItem).OfficeRate,
WindowsRate = ((Rates) _ratesAll.CurrentItem).WindowsRate,
EmoRate = ((Rates) _ratesAll.CurrentItem).EmotionalRate,
CustRate = ((Rates) _ratesAll.CurrentItem).CustomerRate,
RateId = ((Rates) _ratesAll.CurrentItem).Id
});
}
ParticipantsList.ItemsSource = Participants;
由Syncfusion建議使用此方法,但他們根本沒有記錄TabItem,並且標準方式運行得不好。
非常感謝!這就是我需要的! – 2013-03-05 05:16:31