<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                合規國際互聯網加速 OSASE為企業客戶提供高速穩定SD-WAN國際加速解決方案。 廣告
                最近項目中遇到加載數據的性能問題, 原因是.net4.0的虛擬化支持不夠完成,有好多bug在4.5才修復。 我們只能利用大家通用的做法來延遲加載數據: 每次加載固定少量的數據,當拖動到底后,繼續加載后續相同數量的數據。 思路: 監聽ScrollViewer的VerticalOffsetProperty,如果值達到允許滾動的高度ScrollableHeight,則發出event通知外部處理加載邏輯。 使用方法: 1.對于ItemsControl編輯控件模板,在其中的ScrollViewer中加入behavior。 <ScrollViewer?x?:Name="DG_ScrollViewer"?Focusable="false"> ????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????<i:?Interaction.Behaviors> ????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????<local:?ReachingBottomBehavior?ReachingBottomEvent="LazyLoadingBehavior_OnReachingBottomEvent" /> ????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????</i:?Interaction.Behaviors> 在blend中,比較簡單,直接對控件右鍵,編輯模板/副本,進入ScrollViewer后,把這個behavior拖到ScrollViewer的元素下即可, 生成的代碼就是上面的內容。 xmlns:i?="http://schemas.microsoft.com/expression/2010/interactivity" 2.實現上面ReachingBottomEvent的處理邏輯。比如: ?private?void?LazyLoadingBehavior_OnReachingBottomEvent?() ?????? { ???????????var?vm?=?LayoutRoot.?DataContext?as?MainViewModel; ???????????if?(vm?!=?null) ?????????? { ???????????????int?count?=?dtgRoot.?Items?.Count?; ???????????????for?(int?i?=?count?;?i?<?count?+ 30;?i?++) ?????????????? { ???????????????????vm?.DataItems?.?Add( ????????????????????????????????????new?DataItem?() ??????????????????????????????????? { ????????????????????????????????????????Item1?=?i?.?ToString(), ????????????????????????????????????????Item2?=?i?.?ToString() +?i?.ToString?() ??????????????????????????????????? }); ?????????????? } ?????????? } ?????? } 代碼如下: public?class?ReachingBottomBehavior?:?Behavior<?ScrollViewer> ?? { ???????public?ReachingBottomBehavior?() ?????? { ???????????// Insert code required on object creation below this point. ?????? } ???????protected?override?void?OnAttached() ?????? { ???????????base.OnAttached?(); ???????????// Insert code that you would want run when the Behavior is attached to an object. ???????????var?dpd?=?DependencyPropertyDescriptor.?FromProperty(ScrollViewer?.VerticalOffsetProperty,?AssociatedType); ???????????dpd.AddValueChanged?( ???????????????????????????????AssociatedObject, ?????????????????????????????? (sender, ??????????????????????????????? args) => ?????????????????????????????? { ???????????????????????????????????RaiseReachingBottomEvent(); ?????????????????????????????? }); ?????? } ???????protected?override?void?OnDetaching() ?????? { ???????????base.OnDetaching?(); ???????????// Insert code that you would want run when the Behavior is removed from an object. ?????? } ???????private?void?RaiseReachingBottomEvent() ?????? { ???????????bool?isReachingBottom?=?AssociatedObject.?VerticalOffset?>=?AssociatedObject?.ScrollableHeight; ???????????if?(isReachingBottom?) ?????????? { ???????????????if?(this?.ReachingBottomEvent?!=?null) ?????????????? { ???????????????????this.ReachingBottomEvent?(); ?????????????? } ?????????? } ?????? } ???????public?event?Action?ReachingBottomEvent; ?? } ![](https://box.kancloud.cn/2016-02-02_56b0015c68327.jpg) [![](image/d41d8cd98f00b204e9800998ecf8427e.png)](#)
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看