Howdy、 ピボット要素内に複数のPivotItemを生成したいと思います。世代は進んでいますが、ピボット要素にどのようにテンプレートを適用できるのか分かりません。生成されたピボット要素をデータで埋め込む方法
私が使用する必要があるだろうと思った:
pivotItem.ContentTemplate =(DataTemplateを)Ressources [ "KantinenUebersicht"];
しかし、空のページしか作成されていません。
ressourceファイル内の私のコードは次のようになります:
は私の全体のressourcesが
< .ResourceDictionary のxmlns = "http://schemas.microsoft.com/winfx/2006/ファイルの挿入しましたXAML /プレゼンテーション」 のxmlns:X = "http://schemas.microsoft.com/winfx/2006/xaml">
<DataTemplate x:Key="KantinenTemplate">
<StackPanel VerticalAlignment="Top">
<TextBlock HorizontalAlignment="Left" TextWrapping="Wrap" Text="{Binding name}" FontSize="{StaticResource PhoneFontSizeLarge}" Margin="8,0,0,0" VerticalAlignment="Top"/>
<TextBlock HorizontalAlignment="Left" TextWrapping="Wrap" Text="{Binding entfernung}" Margin="24,0,0,0" FontSize="{StaticResource PhoneFontSizeSmall}" VerticalAlignment="Bottom"/>
</StackPanel>
</DataTemplate>
<DataTemplate x:Key="KantinenUebersicht">
<Grid>
<TextBlock x:Name="KantinenName" FontSize="{StaticResource PhoneFontSizeExtraLarge}" Text="" RenderTransformOrigin="0.566,0.407" Margin="0,0,8,0" Height="55" VerticalAlignment="Top">
<TextBlock.Foreground>
<SolidColorBrush Color="{StaticResource PhoneAccentColor}"/>
</TextBlock.Foreground>
</TextBlock>
<TextBlock x:Name="sdfsdf" HorizontalAlignment="Left" Height="40" Margin="8,59,0,0" TextWrapping="Wrap" Text="TextBlock" VerticalAlignment="Top" Width="196"/>
<TextBlock x:Name="lblGeoefsdfsdffnet" Height="40" Margin="208,59,8,0" TextWrapping="Wrap" Text="TextBlock" VerticalAlignment="Top"/>
</Grid>
</DataTemplate></ResourceDictionary.>
をしなければなりませんでした挿入する。最初のタグに...
実際にはリソースの2番目の「s」はボックスに入力中に起こるエラーでした。しかし、欠落しているのは ''ですが、それを自分のressourcesファイルに追加すると、エラーが返されます。 –
theXs
@theXsあなたの "ressources file"は何ですか?上記の私のコードサンプルは、MainPage.xamlのものです。 –
私のRessourceFile名は今まで "ResourceDictionary1.xaml"です。私はデバッグし、 "this.resources"の下に見えるものをチェックしようとしましたが、それは空の辞書です - なぜ私は出力が見えないのでしょうか? – theXs