• Silverlight ScrollViewer 根据内容自动控制滚动条


    最近在研究 大文件上传 还要批量 还要支持断点续传

    看来很多文件 最后在网络上找到了一个silverlight做的

    还是要根据需求去做修改 因为之前没有搞过silverlight 

    但感觉和WPF有些相似

    废话不多少 说问题

    在原项目中 添加太多文件 是看不到超出画幕的部分

    看来一下代码

    <ScrollViewer Grid.Row="1" HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Visible" Background="White">
                <ItemsControl x:Name="FileList" Height="193" Width="1200">
                    <ItemsControl.ItemTemplate>
                        <DataTemplate>
                            <local:FileRowControl></local:FileRowControl>
                        </DataTemplate>
                    </ItemsControl.ItemTemplate>
                </ItemsControl>
            </ScrollViewer>
    

      

    搜了很多 知道了

    ScrollViewer在Silverlight中是一个很常用的控件,它有以下一些常用可设置属性:

      HorizontalScrollBarVisibility:水平方向滚动条

      VerticalScrollBarVisibility:垂直方向滚动条

    这两个属性来控制 滚动条的

    其值为ScrollBarVisibility枚举类型分为

      Disabled:不显示,但是可以通过鼠标或者键盘移动文字内容

      Auto:根据内容宽度和高度自动决定是否出现滚动条

      Hidden:总是隐藏滚动条,无法移动被遮挡的内容

      Visible:总是显示滚动条

    但是更改成auto后还是不可以

    <ScrollViewer Grid.Row="1" HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Visible" Background="White">
                <ItemsControl x:Name="FileList" Height="193" Width="1200">
                    <ItemsControl.ItemTemplate>
                        <DataTemplate>
                            <local:FileRowControl></local:FileRowControl>
                        </DataTemplate>
                    </ItemsControl.ItemTemplate>
                </ItemsControl>
            </ScrollViewer>

    接着就看到网上的demo 是有个宽高的 才知道  源代码是 把宽高加错地方了

     <ItemsControl x:Name="FileList" Height="193" Width="1200">
    

      不是在这里 而是要把宽高添加到ScrollViewer 这个上面

    <ScrollViewer Grid.Row="1" HorizontalScrollBarVisibility="Auto"  Height="193" Width="1200" VerticalScrollBarVisibility="Visible" Background="White">
                <ItemsControl x:Name="FileList">
                    <ItemsControl.ItemTemplate>
                        <DataTemplate>
                            <local:FileRowControl></local:FileRowControl>
                        </DataTemplate>
                    </ItemsControl.ItemTemplate>
                </ItemsControl>
            </ScrollViewer>

    OK

    我们的QQ群:

    ASP.NET零度交流群

     105568127

  • 相关阅读:
    nyoj--767--因子和(模拟)
    poj--1703--Find them, Catch them(并查集巧用)
    nyoj--1009--So Easy[Ⅰ](数学)
    nyoj--1011--So Easy[II](数学几何水题)
    nyoj--311--完全背包(动态规划,完全背包)
    morhpia(4)-更新
    morphia(5)-删除
    morphia(6-1)-查询
    redis 分页
    mongodb-安装&配置&启动
  • 原文地址:https://www.cnblogs.com/acgk/p/3478047.html
Copyright © 2020-2023  润新知