2013-08-02 28 views
1

所以我在我的Page.Resources中定義了一個DataTemplate,它在GridView中用於顯示我的數據。如何更改來自XAML中DataTemplate的第一個孩子的風格?

它基本上是一樣的,在GroupedItemsPage模板用VS 2012

 <DataTemplate x:Key="menuGroupTemplate"> 
     <Grid x:Name="itemSquare" HorizontalAlignment="Left" Width="250" Height="250" Tapped="itemSquare_Tapped"> 
      <Border Background="{StaticResource ListViewItemPlaceholderBackgroundThemeBrush}"> 
       <Image Source="{Binding Image}" Stretch="UniformToFill" AutomationProperties.Name="{Binding Title}"/> 
      </Border> 
      <StackPanel VerticalAlignment="Bottom" Background="{StaticResource ListViewItemOverlayBackgroundThemeBrush}"> 
       <TextBlock Text="{Binding DisplayName}" Foreground="{StaticResource ListViewItemOverlayForegroundThemeBrush}" Style="{StaticResource TitleTextStyle}" Height="60" Margin="15,0,15,0"/> 
       <TextBlock Text="{Binding Subtitle}" Foreground="{StaticResource ListViewItemOverlaySecondaryForegroundThemeBrush}" Style="{StaticResource CaptionTextStyle}" TextWrapping="NoWrap" Margin="15,0,15,10"/> 
      </StackPanel> 
     </Grid> 
    </DataTemplate> 
未來

現在,這使我的團是這樣的:

Linear ordered items

所有物品看上去一樣,正方形都一樣大小!

現在我想創建一個DataTemplate這使得第一項目組中有很多大的休息,以便它看起來像這樣:(從IdeaPress WordPress的應用程序導出)

Different ordered items

所以現在我想改變組中第一個元素的樣式/外觀/大小,但我找不到一種方法來檢索第一個元素並改變它的大小。

Ideapress應用程序的問題在於,當我使用C#時,它完全用HTML/JS編寫,並且它們沒有使用任何DataTemplate或類似的東西來顯示它們的數據,所以只需從它們中複製它們爲我工作。至少都是Windows應用商店。

我曾經想過在構造函數中這樣做,但其他場景失敗。但是,當我有這種感覺時,必須有一種不同的,更優雅的方式來實現這一點。

任何幫助將不勝感激。

回答

1

您需要兩個不同的模板才能做到這一點。 這link是有用的,並提供了一個樣品,以優雅的方式做你需要的。

+0

經過一段時間玩了你推薦的項目後,我終於找到了解決問題的方法,我將發佈一個自定義的UI元素,這個元素的啓發來源於你後來在這裏指出的內容! – Evils

相關問題