我有一个基本的集线器应用程序,我要做的第一件事是布局一些GridView项目。但是,其中一个项目有不同的风格,我无法弄清楚为什么。为什么这一项表现不同?
我从HubView初学者项目开始,用以下内容替换了其中一个部分:
<HubSection Width="500" x:Uid="Section1Header" Header="Section 1">
<DataTemplate>
<Grid >
<GridView x:Name="DistrictIconGV" Background="Black">
<GridView.ItemTemplate>
<DataTemplate>
<Grid Height="155" Width="115" Margin="20,5,20,0" VerticalAlignment="Top" HorizontalAlignment="Left" Background="#FFFF5F5F">
<Image Height="80" Width="80" Source="{Binding Icon}" VerticalAlignment="Top" Margin="0,15,0,0"/>
<TextBlock HorizontalAlignment="Center" TextAlignment="Center" TextWrapping="Wrap" Text="{Binding Name}" Margin="0,100,0,0" VerticalAlignment="Top" Height="60" Width="115"/>
<Ellipse HorizontalAlignment="Left" Height="24" Margin="74,4,0,0" VerticalAlignment="Top" Width="24" RenderTransformOrigin="1.508,0.48" Visibility="{Binding UnreadVisible}">
<Ellipse.Stroke>
<SolidColorBrush Color="White" Opacity="0"/>
</Ellipse.Stroke>
<Ellipse.Fill>
<LinearGradientBrush EndPoint="19,30.5" StartPoint="19,0.5" SpreadMethod="Repeat" MappingMode="Absolute">
<GradientStop Color="#FFF9C5C5" Offset="0.253"/>
<GradientStop Color="Red" Offset="0.677"/>
</LinearGradientBrush>
</Ellipse.Fill>
</Ellipse>
<TextBlock HorizontalAlignment="Center" Margin="69,4,11,0" TextWrapping="Wrap" Text="{Binding UnreadCount}" VerticalAlignment="Top" TextAlignment="Center" Height="22" Width="22" FontSize="16" Visibility="{Binding UnreadVisible}" Foreground="Black"/>
</Grid>
</DataTemplate>
</GridView.ItemTemplate>
<!-- This data is only for testing the layout, it will be overriden at run time-->
<local:IconListItem IconSource="ms-appx:///Assets/Logo.png" Name="Blitzen" UnreadCount="33"/>
<local:IconListItem IconSource="ms-appx:///Assets/Logo.png" Name="Comet"/>
<local:IconListItem IconSource="ms-appx:///Assets/Logo.png" Name="Cupid"/>
<local:IconListItem IconSource="ms-appx:///Assets/Logo.png" Name="Dasher"/>
<local:IconListItem IconSource="ms-appx:///Assets/Logo.png" Name="Dancer"/>
<local:IconListItem IconSource="ms-appx:///Assets/Logo.png" Name="Donner"/>
<local:IconListItem IconSource="ms-appx:///Assets/Logo.png" Name="Vixen"/>
<local:IconListItem IconSource="ms-appx:///Assets/Logo.png" Name="Prancer"/>
</GridView>
</Grid>
</DataTemplate>
</HubSection>
任何想法?
答案 0 :(得分:2)
想出来,这是一个奇怪的。椭圆可见之后的任何项目都会因某种原因而改变样式。如果我用下面的椭圆替换项目模板中的椭圆,问题就会消失。
<Ellipse HorizontalAlignment="Left" Height="24" Margin="74,4,0,0" VerticalAlignment="Top" Width="24" RenderTransformOrigin="1.508,0.48" Visibility="{Binding UnreadVisible}">
<Ellipse.Fill>
<SolidColorBrush Color="#FFF94141" Opacity="0.8"/>
</Ellipse.Fill>
</Ellipse>