草庐IT

windows - WP7 Horizo​​ntal ListBox 末尾的项目被切断

coder 2024-06-15 原文

我遇到了一个令人沮丧的问题,我的列表框中的最后几个项目被截断了。

我已将我的列表框设置为水平滚动和显示。我的 ItemPanelTemplate 包含一个 VirtualizedStackPanel(当我使用普通的堆栈面板时,我的列表框只显示有限数量的项目,而虚拟的显示除了最后两个之外的所有项目)

我必须指出,当我将其从水平更改为垂直时,一切正常,这是我的 xaml。

请帮忙

<Grid Name="JumpTo" Visibility="Collapsed" Background="#FF0A0909" Opacity="0.95" >
    <TextBlock Text="Jump To"/>
    <ListBox ItemsSource="{Binding}" 
             HorizontalAlignment="Left" 
             Name="lbJumpTo" 
             VerticalAlignment="Top" 
             SelectionChanged="lbJumpTo_SelectionChanged" 
             Height="248" Width="623" 
             Margin="34,77,0,0" ScrollViewer.HorizontalScrollBarVisibility="Auto">
        <ListBox.ItemsPanel>
            <ItemsPanelTemplate>
                <VirtualizingStackPanel Orientation="Horizontal"></VirtualizingStackPanel>
            </ItemsPanelTemplate>    
        </ListBox.ItemsPanel>

        <ListBox.ItemTemplate>
            <DataTemplate>

                <StackPanel Orientation="Vertical" Width="200" Height="160">

                    <Grid x:Name="gridLoop" Height="90" Width="150" Background="{x:Null}">
                        <Grid.RowDefinitions>
                            <RowDefinition />
                            <RowDefinition />
                            <RowDefinition />
                            <RowDefinition />
                            <RowDefinition />
                            <RowDefinition />
                        </Grid.RowDefinitions>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition />
                            <ColumnDefinition />
                            <ColumnDefinition />
                            <ColumnDefinition />
                            <ColumnDefinition />
                            <ColumnDefinition />
                            <ColumnDefinition />
                            <ColumnDefinition />
                        </Grid.ColumnDefinitions>

                        <Image Source="{Binding LoopDisplayMatrix[0][0]}" Grid.Row="0" Grid.Column="0" Width="20" Height="20"/>
                        <Image Source="{Binding LoopDisplayMatrix[0][1]}" Grid.Row="0" Grid.Column="1"  Width="20" Height="20"/>
                        <Image Source="{Binding LoopDisplayMatrix[0][2]}" Grid.Row="0" Grid.Column="2"  Width="20" Height="20"/>
                        <Image Source="{Binding LoopDisplayMatrix[0][3]}" Grid.Row="0" Grid.Column="3"  Width="20" Height="20"/>
                        <Image Source="{Binding LoopDisplayMatrix[0][4]}" Grid.Row="0" Grid.Column="4" Width="20" Height="20"/>
                        <Image Source="{Binding LoopDisplayMatrix[0][5]}" Grid.Row="0" Grid.Column="5" Width="20" Height="20"/>
                        <Image Source="{Binding LoopDisplayMatrix[0][6]}" Grid.Row="0" Grid.Column="6" Width="20" Height="20"/>
                        <Image Source="{Binding LoopDisplayMatrix[0][7]}" Grid.Row="0" Grid.Column="7" Width="20" Height="20"/>

                        <Image Source="{Binding LoopDisplayMatrix[1][0]}" Grid.Row="1" Grid.Column="0" Width="20" Height="20"/>
                        <Image Source="{Binding LoopDisplayMatrix[1][1]}" Grid.Row="1" Grid.Column="1" Width="20" Height="20"/>
                        <Image Source="{Binding LoopDisplayMatrix[1][2]}" Grid.Row="1" Grid.Column="2" Width="20" Height="20"/>
                        <Image Source="{Binding LoopDisplayMatrix[1][3]}" Grid.Row="1" Grid.Column="3" Width="20" Height="20"/>
                        <Image Source="{Binding LoopDisplayMatrix[1][4]}" Grid.Row="1" Grid.Column="4" Width="20" Height="20"/>
                        <Image Source="{Binding LoopDisplayMatrix[1][5]}" Grid.Row="1" Grid.Column="5" Width="20" Height="20"/>
                        <Image Source="{Binding LoopDisplayMatrix[1][6]}" Grid.Row="1" Grid.Column="6" Width="20" Height="20"/>
                        <Image Source="{Binding LoopDisplayMatrix[1][7]}" Grid.Row="1" Grid.Column="7" Width="20" Height="20"/>

                        <Image Source="{Binding LoopDisplayMatrix[2][0]}" Grid.Row="2" Grid.Column="0" Width="20" Height="20"/>
                        <Image Source="{Binding LoopDisplayMatrix[2][1]}" Grid.Row="2" Grid.Column="1" Width="20" Height="20"/>
                        <Image Source="{Binding LoopDisplayMatrix[2][2]}" Grid.Row="2" Grid.Column="2" Width="20" Height="20"/>
                        <Image Source="{Binding LoopDisplayMatrix[2][3]}" Grid.Row="2" Grid.Column="3" Width="20" Height="20"/>
                        <Image Source="{Binding LoopDisplayMatrix[2][4]}" Grid.Row="2" Grid.Column="4" Width="20" Height="20"/>
                        <Image Source="{Binding LoopDisplayMatrix[2][5]}" Grid.Row="2" Grid.Column="5" Width="20" Height="20"/>
                        <Image Source="{Binding LoopDisplayMatrix[2][6]}" Grid.Row="2" Grid.Column="6" Width="20" Height="20"/>
                        <Image Source="{Binding LoopDisplayMatrix[2][7]}" Grid.Row="2" Grid.Column="7" Width="20" Height="20"/>

                        <Image Source="{Binding LoopDisplayMatrix[3][0]}" Grid.Row="3" Grid.Column="0" Width="20" Height="20"/>
                        <Image Source="{Binding LoopDisplayMatrix[3][1]}" Grid.Row="3" Grid.Column="1" Width="20" Height="20"/>
                        <Image Source="{Binding LoopDisplayMatrix[3][2]}" Grid.Row="3" Grid.Column="2" Width="20" Height="20"/>
                        <Image Source="{Binding LoopDisplayMatrix[3][3]}" Grid.Row="3" Grid.Column="3" Width="20" Height="20"/>
                        <Image Source="{Binding LoopDisplayMatrix[3][4]}" Grid.Row="3" Grid.Column="4" Width="20" Height="20"/>
                        <Image Source="{Binding LoopDisplayMatrix[3][5]}" Grid.Row="3" Grid.Column="5" Width="20" Height="20"/>
                        <Image Source="{Binding LoopDisplayMatrix[3][6]}" Grid.Row="3" Grid.Column="6" Width="20" Height="20"/>
                        <Image Source="{Binding LoopDisplayMatrix[3][7]}" Grid.Row="3" Grid.Column="7" Width="20" Height="20"/>

                        <Image Source="{Binding LoopDisplayMatrix[4][0]}" Grid.Row="4" Grid.Column="0" Width="20" Height="20"/>
                        <Image Source="{Binding LoopDisplayMatrix[4][1]}" Grid.Row="4" Grid.Column="1" Width="20" Height="20"/>
                        <Image Source="{Binding LoopDisplayMatrix[4][2]}" Grid.Row="4" Grid.Column="2" Width="20" Height="20"/>
                        <Image Source="{Binding LoopDisplayMatrix[4][3]}" Grid.Row="4" Grid.Column="3" Width="20" Height="20"/>
                        <Image Source="{Binding LoopDisplayMatrix[4][4]}" Grid.Row="4" Grid.Column="4" Width="20" Height="20"/>
                        <Image Source="{Binding LoopDisplayMatrix[4][5]}" Grid.Row="4" Grid.Column="5" Width="20" Height="20"/>
                        <Image Source="{Binding LoopDisplayMatrix[4][6]}" Grid.Row="4" Grid.Column="6" Width="20" Height="20"/>
                        <Image Source="{Binding LoopDisplayMatrix[4][7]}" Grid.Row="4" Grid.Column="7" Width="20" Height="20"/>

                        <Image Source="{Binding LoopDisplayMatrix[5][0]}" Grid.Row="5" Grid.Column="0" Width="20" Height="20"/>
                        <Image Source="{Binding LoopDisplayMatrix[5][1]}" Grid.Row="5" Grid.Column="1" Width="20" Height="20"/>
                        <Image Source="{Binding LoopDisplayMatrix[5][2]}" Grid.Row="5" Grid.Column="2" Width="20" Height="20"/>
                        <Image Source="{Binding LoopDisplayMatrix[5][3]}" Grid.Row="5" Grid.Column="3" Width="20" Height="20"/>
                        <Image Source="{Binding LoopDisplayMatrix[5][4]}" Grid.Row="5" Grid.Column="4" Width="20" Height="20"/>
                        <Image Source="{Binding LoopDisplayMatrix[5][5]}" Grid.Row="5" Grid.Column="5" Width="20" Height="20"/>
                        <Image Source="{Binding LoopDisplayMatrix[5][6]}" Grid.Row="5" Grid.Column="6" Width="20" Height="20"/>
                        <Image Source="{Binding LoopDisplayMatrix[5][7]}" Grid.Row="5" Grid.Column="7" Width="20" Height="20"/>

                    </Grid>

                    <StackPanel Orientation="Vertical" Height="50" Width="100">
                        <TextBlock Text="{Binding LoopName}" Width="150" Height="40"  />
                        <TextBlock Text="{Binding TempoDisplay}" Width="150" Height="40"  />
                    </StackPanel>

                </StackPanel>

            </DataTemplate>
        </ListBox.ItemTemplate>
    </ListBox>
</Grid>

最佳答案

干杯 Senthil Kumar。我将数据模板中 Top Stackpanel 的宽度设置为自动,这解决了我的问题。

关于windows - WP7 Horizo​​ntal ListBox 末尾的项目被切断,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10428098/

有关windows - WP7 Horizo​​ntal ListBox 末尾的项目被切断的更多相关文章

  1. ruby - 在 Ruby 程序执行时阻止 Windows 7 PC 进入休眠状态 - 2

    我需要在客户计算机上运行Ruby应用程序。通常需要几天才能完成(复制大备份文件)。问题是如果启用sleep,它会中断应用程序。否则,计算机将持续运行数周,直到我下次访问为止。有什么方法可以防止执行期间休眠并让Windows在执行后休眠吗?欢迎任何疯狂的想法;-) 最佳答案 Here建议使用SetThreadExecutionStateWinAPI函数,使应用程序能够通知系统它正在使用中,从而防止系统在应用程序运行时进入休眠状态或关闭显示。像这样的东西:require'Win32API'ES_AWAYMODE_REQUIRED=0x0

  2. ruby - 如何将脚本文件的末尾读取为数据文件(Perl 或任何其他语言) - 2

    我正在寻找执行以下操作的正确语法(在Perl、Shell或Ruby中):#variabletoaccessthedatalinesappendedasafileEND_OF_SCRIPT_MARKERrawdatastartshereanditcontinues. 最佳答案 Perl用__DATA__做这个:#!/usr/bin/perlusestrict;usewarnings;while(){print;}__DATA__Texttoprintgoeshere 关于ruby-如何将脚

  3. ruby - 在 Windows 机器上使用 Ruby 进行开发是否会适得其反? - 2

    这似乎非常适得其反,因为太多的gem会在window上破裂。我一直在处理很多mysql和ruby​​-mysqlgem问题(gem本身发生段错误,一个名为UnixSocket的类显然在Windows机器上不能正常工作,等等)。我只是在浪费时间吗?我应该转向不同的脚本语言吗? 最佳答案 我在Windows上使用Ruby的经验很少,但是当我开始使用Ruby时,我是在Windows上,我的总体印象是它不是Windows原生系统。因此,在主要使用Windows多年之后,开始使用Ruby促使我切换回原来的系统Unix,这次是Linux。Rub

  4. Vscode+Cmake配置并运行opencv环境(Windows和Ubuntu大同小异) - 2

    之前在培训新生的时候,windows环境下配置opencv环境一直教的都是网上主流的vsstudio配置属性表,但是这个似乎对新生来说难度略高(虽然个人觉得完全是他们自己的问题),加之暑假之后对cmake实在是爱不释手,且这样配置确实十分简单(其实都不需要配置),故斗胆妄言vscode下配置CV之法。其实极为简单,图比较多所以很长。如果你看此文还配不好,你应该思考一下是不是自己的问题。闲话少说,直接开始。0.CMkae简介有的人到大二了都不知道cmake是什么,我不说是谁。CMake是一个开源免费并且跨平台的构建工具,可以用简单的语句来描述所有平台的编译过程。它能够根据当前所在平台输出对应的m

  5. 深度学习部署:Windows安装pycocotools报错解决方法 - 2

    深度学习部署:Windows安装pycocotools报错解决方法1.pycocotools库的简介2.pycocotools安装的坑3.解决办法更多Ai资讯:公主号AiCharm本系列是作者在跑一些深度学习实例时,遇到的各种各样的问题及解决办法,希望能够帮助到大家。ERROR:Commanderroredoutwithexitstatus1:'D:\Anaconda3\python.exe'-u-c'importsys,setuptools,tokenize;sys.argv[0]='"'"'C:\\Users\\46653\\AppData\\Local\\Temp\\pip-instal

  6. ruby - 如何在 Ruby 中执行 Windows CLI 命令? - 2

    我在目录“C:\DocumentsandSettings\test.exe”中有一个文件,但是当我用单引号编写命令时`C:\DocumentsandSettings\test.exe(我无法在此框中显示),用于在Ruby中执行命令,我无法这样做,我收到的错误是找不到文件或目录。我尝试用“//”和“\”替换“\”,但似乎没有任何效果。我也使用过系统、IO.popen和exec命令,但所有的努力都是徒劳的。exec命令还使程序退出,这是我不想发生的。提前致谢。 最佳答案 反引号环境就像双引号,所以反斜杠用于转义。此外,Ruby会将空格解

  7. ruby - 在 ruby​​ 中对字符串进行排序以使空字符串位于末尾的好方法是什么? - 2

    在Ruby中,默认排序将空字符串放在第一位。['','g','z','a','r','u','','n'].sort给予:["","","a","g","n","r","u","z"]但是,在end处需要空字符串是很常见的。做类似的事情:['','g','z','a','r','u','','n'].sort{|a,b|a[0]&&b[0]?ab:a[0]?-1:b[0]?1:0}工作并给予:["a","g","n","r","u","z","",""]但是,这不是很可读,也不是很灵活。在Ruby中是否有一种合理且干净的方法让sort将空字符串放在最后?只映射到一个没有空字符串的数组,

  8. ruby - 从 Ruby 中的数组末尾删除 nil 项 - 2

    给定一个数组:[1,2,nil,nil,3,nil,4,5,6,nil,nil,nil]id喜欢从数组末尾删除nil。用一些丑陋的循环来解决并不难,但我希望有一种Ruby方法可以做到这一点。Result:[1,2,nil,nil,3,nil,4,5,6] 最佳答案 这个怎么样:a.popuntila.last 关于ruby-从Ruby中的数组末尾删除nil项,我们在StackOverflow上找到一个类似的问题: https://stackoverflow.c

  9. ruby - 错误 : Failed to build gem native extension on Windows - 2

    我在安装“redcarpet”gem时遇到以下错误。它在我friend的机器上安装没有问题。(我想安装它来运行yard)ruby版本:1.9.3命令输出:D:\Learning\Common_POM_FW\SampleProjects>yard[error]:Missing'redcarpet'gemforMarkdownformatting.Installitwith`geminstallredcarpet`D:\Learning\Common_POM_FW\SampleProjects>geminstallredcarpetTemporarilyenhancingPATHtoinc

  10. ruby - 从 Ruby 连接到适用于 Windows Phone 8 的 Microsoft 推送通知服务 - 2

    我们正在开发一个需要推送通知的WP8应用程序。为了测试它,我们使用CURL命令行运行推送通知POST请求,确保它实际连接,使用客户端SSL证书进行身份验证并发送正确的数据。我们确实知道,当我们收到对设备的推送时,这项工作是有效的。这是我们一直用于测试目的的CURL命令:curl--certclient_cert.pem-v-H"Content-Type:text/xml"-H"X-WindowsPhone-Target:Toast"-H"X-NotificationClass:2"-XPOST-d"MytitleMysubtitle"https://db3.notify.live.ne

随机推荐