日本好好热aⅴ|国产99视频精品免费观看|日本成人aV在线|久热香蕉国产在线

  • <cite id="ikgdy"><table id="ikgdy"></table></cite>
    1. 西西軟件園多重安全檢測下載網(wǎng)站、值得信賴的軟件下載站!
      軟件
      軟件
      文章
      搜索

      首頁編程開發(fā)其它知識 → wp7高級容器怎么動態(tài)更新數(shù)據(jù)

      wp7高級容器怎么動態(tài)更新數(shù)據(jù)

      相關(guān)軟件相關(guān)文章發(fā)表評論 來源:西西整理時間:2012/8/21 11:59:42字體大。A-A+

      作者:佚名點(diǎn)擊:1次評論:0次標(biāo)簽: 高級容器

      全景視圖Panorama    這里面最有意思的就是這個背景圖片了。。會隨著你的移動而移動,視覺效果非常的好,右邊還會提示下一頁的內(nèi)容,當(dāng)然這個內(nèi)容展示就像一個圈一樣,沒有盡頭?梢砸恢狈

      1 <sc:Panorama Title="商場">
      2             <sc:Panorama.Background>
      3                 <ImageBrush  ImageSource="mm.jpg"></ImageBrush>
      4             </sc:Panorama.Background>
      5             <sc:PanoramaItem Header="電腦銷售" >
      6                 <StackPanel>
      7                 <TextBlock>筆記本</TextBlock>
      8                 <TextBlock>臺式機(jī)</TextBlock>
      9                 </StackPanel>
      10             </sc:PanoramaItem>
      11             <sc:PanoramaItem Header="手機(jī)銷售" >
      12                 <StackPanel>
      13                     <TextBlock>HTC</TextBlock>
      14                     <TextBlock>蘋果</TextBlock>
      15                 </StackPanel>
      16             </sc:PanoramaItem>
      17
      18         </sc:Panorama>

      樞軸視圖Pivot的用法,類似于我們操作系統(tǒng)的菜單

      1 <sc:Pivot>
      2             <sc:PivotItem Header="電腦">
      3                 <StackPanel >
      4                     <TextBlock>筆記本</TextBlock>
      5                     <TextBlock>臺式機(jī)</TextBlock>
      6                 </StackPanel>
      7             </sc:PivotItem>
      8             <sc:PivotItem Header="手機(jī)">
      9                 <StackPanel >
      10                     <TextBlock>HTC</TextBlock>
      11                     <TextBlock>蘋果</TextBlock>
      12                 </StackPanel>
      13             </sc:PivotItem>
      14         </sc:Pivot>

      ScrollViewer用于顯示大內(nèi)容,顯示尺寸不夠則可以通過滾動條控制。HorizontalScrollBarVisibility、VerticalScrollBarVisibility控制滾動條顯示

      1 <ScrollViewer Name="sv1" Height="300" Width="300">
      2             <toolkit:WrapPanel Name="wp1">
      3                 <Button Content="1" Width="120"></Button>
      4                 <Button Content="1" Width="120"></Button>
      5                 <Button Content="1" Width="120"></Button>
      6                 <Button Content="1" Width="120"></Button>
      7                 <Button Content="1" Width="120"></Button>
      8                 <Button Content="1" Width="120"></Button>
      9             </toolkit:WrapPanel>
      10         </ScrollViewer>

      如果我們想在用戶拉到最底下時動態(tài)的更新新的數(shù)據(jù),想微博那樣一直往下拉,會加載新的內(nèi)容,我們可以在下拉到底部的時候給控件注冊個事件來達(dá)到我們的需求

      1 ScrollViewerMonitor svm = new ScrollViewerMonitor(sv1);
      2             svm.AtEnd += new EventHandler(svm_AtEnd);
      3         }
      4
      5         void svm_AtEnd(object sender, EventArgs e)
      6         {
      7             for (int i=0; i < 10; i++)
      8             {
      9                 Button btn = new Button();
      10                 btn.Content = Guid.NewGuid().ToString().Substring(0, 5);
      11                 wp1.Children.Add(btn);
      12             }
      13         }

      下面是ScrollViewerMonitor類的內(nèi)容,

      動態(tài)監(jiān)視scrollViewer.VerticalOffset的值當(dāng)它超過本身的高度的時候就觸發(fā)AtEnd 事件,我們可以在外部注冊這個事件!

      1 public class ScrollViewerMonitor
      2     {
      3         private ScrollViewer scrollViewer;
      4
      5         private static int index;
      6
      7         public ScrollViewerMonitor(ScrollViewer scrollViewer)
      8         {
      9             this.scrollViewer = scrollViewer;
      10
      11             var property = DependencyProperty.RegisterAttached("DependencyPropertyListener" + index++,
      12                 typeof(double), typeof(ScrollViewer), new PropertyMetadata(scrollViewerVerticalOffset_Changed));
      13
      14             Binding binding = new Binding("VerticalOffset") { Source = scrollViewer };
      15             scrollViewer.SetBinding(property, binding);
      16         }
      17
      18         public event EventHandler AtEnd;
      19
      20         private void scrollViewerVerticalOffset_Changed(DependencyObject d, DependencyPropertyChangedEventArgs e)
      21         {
      22             bool atBottom = scrollViewer.VerticalOffset
      23                                     >= scrollViewer.ScrollableHeight;
      24
      25             if (atBottom)
      26             {
      27                 if (AtEnd != null)
      28                 {
      29                     AtEnd(this, EventArgs.Empty);
      30                 }
      31             }
      32         }
      33     }

        相關(guān)評論

        閱讀本文后您有什么感想? 已有人給出評價!

        • 8 喜歡喜歡
        • 3 頂
        • 1 難過難過
        • 5 囧
        • 3 圍觀圍觀
        • 2 無聊無聊

        熱門評論

        最新評論

        發(fā)表評論 查看所有評論(0)

        昵稱:
        表情: 高興 可 汗 我不要 害羞 好 下下下 送花 屎 親親
        字?jǐn)?shù): 0/500 (您的評論需要經(jīng)過審核才能顯示)