[W8.1] [XAML]消失的项目 [英] [W8.1][XAML]Disappearing Items

查看:92
本文介绍了[W8.1] [XAML]消失的项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Windows 8.1应用。我有一个位于GridView内部的SemanticZoom。当gridview首次生成项目时,它们显示正常。放大和缩小后,项目有时偏离中心。有时它会完全消失,只有
的方法才能找到它,然后转到另一个页面然后回来。 (一旦我被允许发布图像,我可以显示它的样子)


我已经尝试在每个控件中禁用ScrollViewer,但这似乎不起作用。我的怀疑是物品过渡或某些东西出了问题,但我不太了解过渡。


有没有人看过这个或者有任何想法如何修复它? / p>


XAML是:

< Hub x:Name =" MainHub" Style =" {ThemeResource HomePageHub}" > 

< HubSection x:Name =" TMT" MinWidth = QUOT; 400"
Horizo​​ntalContentAlignment =" Stretch"
Header =" Test Management Tool"
IsHeaderInteractive =" False"
背景="黑色"不透明度= QUOT; 0.75"
Horizo​​ntalAlignment =" Stretch" >
< DataTemplate>

< GridView x:Name =" TMTGrid"
ItemsSource =" {Binding}"
SelectionMode =" None"
Horizo​​ntalContentAlignment =" Stretch"
ScrollViewer.Horizo​​ntalScrollMode ="已禁用"
ScrollViewer.IsHorizo​​ntalRailEnabled =" False"
ScrollViewer.VerticalScrollMode ="已禁用"
ScrollViewer.IsVerticalRailEnabled =" False">

< GridView.ItemsPanel>
< ItemsPanelTemplate>
< StackPanel Orientation =" Horizo​​ntal" />
< / ItemsPanelTemplate>
< /GridView.ItemsPanel>

< GridView.ItemTemplate>
< DataTemplate>
< SemanticZoom x:Name =" ProjectZoom"
IsZoomedInViewActive =" False"
Width =" {Binding Path = ProjectWidth}"
ViewChangeCompleted =" ProjectZoom_ViewChangeCompleted"
ScrollViewer.IsHorizo​​ntalRailEnabled =" False"
ScrollViewer.Horizo​​ntalScrollMode ="已禁用">
<! - 缩小 - >
< SemanticZoom.ZoomedOutView>
< GridView x:Name =" zoGrid"的ItemsSource = QUOT; {结合}"
IsZoomedInView =" False"的SelectionMode = QUOT;无"
Margin =" 5"填充= QUOT; 0">
< Grid Width =" 250"高度= QUOT; 460">
< Grid.RowDefinitions>
< RowDefinition Height =" 40" />
< RowDefinition Height =" 55" />
< RowDefinition Height =" 40" />
< RowDefinition Height =" 55" />
< RowDefinition Height =" 40" />
< RowDefinition Height =" 230" />
< /Grid.RowDefinitions>
<! - 带有绑定文本的一些TextBlocks在这里 - >
< / Grid>
< / GridView>
< /SemanticZoom.ZoomedOutView>

<! - 放大 - >
< SemanticZoom.ZoomedInView>
< GridView x:Name =" ziGrid"
ItemsSource =" {Binding Path = Segments}"
Height =" 460"
VerticalAlignment =" Stretch"
Padding =" 5"
ScrollViewer.VerticalScrollMode ="已禁用"
ScrollViewer.Horizo​​ntalScrollMode ="已禁用">
< GridView.ItemTemplate>
< DataTemplate>
< controls:CanvasIcon x:Name =" CanvasIconOverlay"高度= QUOT; 100"宽度= QUOT; 155"
ItemType =" {Binding Path = ItemType}" UId =" {Binding Path = UId}" ProjectName =" {Binding Path = ProjectName}"
RightTapped =" CanvasIconOverlay_RightTapped" >
< Grid Height =" 100"宽度= QUOT; 155"
Background =" {Binding Path = ItemType,Converter = {StaticResource SegmentColorConverter}}">
< Canvas Height =" 25"宽度= QUOT; 155"不透明度= QUOT; 0.8"背景= QUOT;黑色" VerticalAlignment = QUOT;顶部和QUOT;>
< TextBlock Style =" {StaticResource TextBlockSegmentSelectHeaderStyle}" Text =" {Binding Path = ItemType}" />
< / Canvas>
< TextBlock Text =" {Binding Path = Summary}" TextWrapping = QUOT; WrapWholeWords"
身高="75" Style =" {StaticResource TextBlockSegmentSelectStyle}" />
< TextBlock Text =" {Binding Path = UId}" Style =" {StaticResource TextBlockProjectSelectStyle}"
VerticalAlignment =" Bottom"的Horizo​​ntalAlignment = QUOT;右"字号= QUOT 11 QUOT; />
< / Grid>
< / controls:CanvasIcon>
< / DataTemplate>
< /GridView.ItemTemplate>
< / GridView>
< /SemanticZoom.ZoomedInView>

< / SemanticZoom>
< / DataTemplate>
< /GridView.ItemTemplate>
< / GridView>
< / DataTemplate>

< / HubSection>
< / Hub>



解决方案

您可以上传可重现的代码示例到OneDrive并在此处发布链接。


以下是代码示例:
https://code.msdn.microsoft.com/windowsapps/GroupedGridView-77c59e8e


I am working on a Windows 8.1 app. I have a SemanticZoom that is inside of a GridView. When the gridview first generates the items, they display fine. After I zoom in and out, the item is sometimes off center. Sometimes it disappears completely and the only way to get it back is to go to a different page and come back. (Once I am allowed to post images I can show what it looks like)

I have tried disabling the ScrollViewer in every control and that didn't seem to work. My suspicion is that something is going wrong with the item transitions or something but I don't know too much about transitions.

Has anyone seen this or have any idea how to fix it?

The XAML is:

        <Hub x:Name="MainHub" Style="{ThemeResource HomePageHub}" >
            
            <HubSection x:Name="TMT" MinWidth="400" 
                        HorizontalContentAlignment="Stretch"
                        Header="Test Management Tool" 
                        IsHeaderInteractive="False"
                        Background="Black" Opacity="0.75" 
                        HorizontalAlignment="Stretch" >
                <DataTemplate>
                    
                    <GridView x:Name="TMTGrid" 
                              ItemsSource="{Binding}" 
                              SelectionMode="None"
                              HorizontalContentAlignment="Stretch"
                              ScrollViewer.HorizontalScrollMode="Disabled"
                              ScrollViewer.IsHorizontalRailEnabled="False"
                              ScrollViewer.VerticalScrollMode="Disabled"
                              ScrollViewer.IsVerticalRailEnabled="False">
                        
                        <GridView.ItemsPanel>
                            <ItemsPanelTemplate>
                                <StackPanel Orientation="Horizontal" />
                            </ItemsPanelTemplate>
                        </GridView.ItemsPanel>
                        
                        <GridView.ItemTemplate>
                            <DataTemplate>
                                <SemanticZoom x:Name="ProjectZoom" 
											  IsZoomedInViewActive="False" 
                                              Width="{Binding Path=ProjectWidth}"
                                              ViewChangeCompleted="ProjectZoom_ViewChangeCompleted"                                              
                                              ScrollViewer.IsHorizontalRailEnabled="False"
                                              ScrollViewer.HorizontalScrollMode="Disabled">
                                    <!-- Zoomed Out -->
                                    <SemanticZoom.ZoomedOutView>
                                        <GridView x:Name="zoGrid" ItemsSource="{Binding}" 
                                                  IsZoomedInView="False" SelectionMode="None" 
                                                  Margin="5" Padding="0">
                                            <Grid Width="250" Height="460">
                                                <Grid.RowDefinitions>
                                                    <RowDefinition Height="40"/>
                                                    <RowDefinition Height="55"/>
                                                    <RowDefinition Height="40"/>
                                                    <RowDefinition Height="55"/>
                                                    <RowDefinition Height="40"/>
                                                    <RowDefinition Height="230"/>
                                                </Grid.RowDefinitions>
                                                <!-- Some TextBlocks with bound text are in here -->
                                            </Grid>
                                        </GridView>
                                    </SemanticZoom.ZoomedOutView>

                                    <!-- Zoomed In -->
                                    <SemanticZoom.ZoomedInView>
                                        <GridView x:Name="ziGrid" 
                                                  ItemsSource="{Binding Path=Segments}" 
                                                  Height="460" 
                                                  VerticalAlignment="Stretch" 
                                                  Padding="5"
                                                  ScrollViewer.VerticalScrollMode="Disabled"
                                                  ScrollViewer.HorizontalScrollMode="Disabled">
                                            <GridView.ItemTemplate>
                                                <DataTemplate>
                                                    <controls:CanvasIcon  x:Name="CanvasIconOverlay" Height="100" Width="155"
                                                                           ItemType="{Binding Path=ItemType}" UId="{Binding Path=UId}" ProjectName="{Binding Path=ProjectName}"
                                                                           RightTapped="CanvasIconOverlay_RightTapped" >
                                                        <Grid Height="100" Width="155" 
                                                          Background="{Binding Path=ItemType, Converter={StaticResource SegmentColorConverter}}">
                                                            <Canvas Height="25" Width="155" Opacity="0.8" Background="Black" VerticalAlignment="Top">
                                                                <TextBlock Style="{StaticResource TextBlockSegmentSelectHeaderStyle}" Text="{Binding Path=ItemType}"/>
                                                            </Canvas>
                                                            <TextBlock Text="{Binding Path=Summary}" TextWrapping="WrapWholeWords"
                                                                   Height="75" Style="{StaticResource TextBlockSegmentSelectStyle}" />
                                                            <TextBlock Text="{Binding Path=UId}" Style="{StaticResource TextBlockProjectSelectStyle}"
                                                                   VerticalAlignment="Bottom" HorizontalAlignment="Right" FontSize="11"/>
                                                        </Grid>
                                                    </controls:CanvasIcon>
                                                </DataTemplate>
                                            </GridView.ItemTemplate>
                                        </GridView>
                                    </SemanticZoom.ZoomedInView>

                                </SemanticZoom>
                            </DataTemplate>
                        </GridView.ItemTemplate>
                    </GridView>
                </DataTemplate>

            </HubSection>
        </Hub>


解决方案

You could upload your reproducible code sample to OneDrive and post link here.

Here is a code sample: https://code.msdn.microsoft.com/windowsapps/GroupedGridView-77c59e8e


这篇关于[W8.1] [XAML]消失的项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆