自拍偷在线精品自拍偷,亚洲欧美中文日韩v在线观看不卡

寫在wp8.1的filpview馬上來臨之際

移動開發(fā)
大家肯定熟悉安卓各種客戶端首頁聯(lián)動圖片廣告(比如淘寶),可以自動滾動,可以手動滑動,當(dāng)然是循環(huán)的。但是在wp上我看到的做的最好的最早的當(dāng)屬愛壁紙了。

一直想寫點東西,直到今天才真正動筆,唯一的原因就是太懶,太懶...

大家肯定熟悉安卓各種客戶端首頁聯(lián)動圖片廣告(比如淘寶),可以自動滾動,可以手動滑動,當(dāng)然是循環(huán)的。但是在wp上我看到的做的***的最早的當(dāng)屬愛壁紙了。

寫在wp8.1的filpview馬上來臨之際。上代碼吧。

如果有4張圖片 應(yīng)該在最前面加上***一張 再在***面加上***張 這樣當(dāng)?shù)阶钋懊婊蛘?**面的時候 直接修改 TranslateX 達(dá)到循環(huán)的效果。

  1. <Style TargetType="snControls:SlideView"
  2.         <Setter Property="Background" Value="{x:Null}" /> 
  3.         <Setter Property="BorderThickness" Value="0" /> 
  4.         <Setter Property="TabNavigation" Value="Once" /> 
  5.         <Setter Property="IsTabStop" Value="False" /> 
  6.         <Setter Property="ItemsPanel"
  7.             <Setter.Value> 
  8.                 <ItemsPanelTemplate> 
  9.                     <VirtualizingStackPanel Orientation="Horizontal" /> 
  10.                 </ItemsPanelTemplate> 
  11.             </Setter.Value> 
  12.         </Setter> 
  13.         <Setter Property="Template"
  14.             <Setter.Value> 
  15.                 <ControlTemplate TargetType="snControls:SlideView"
  16.                     <Grid Background="{TemplateBinding Background}" 
  17.                           Height="{TemplateBinding Height}" 
  18.                           Width="{TemplateBinding Width}"
  19.                         <Border Height="{TemplateBinding Height}" 
  20.                                 BorderThickness="{TemplateBinding BorderThickness}" 
  21.                                 x:Name="InnerBorder"
  22.                             <ItemsPresenter x:Name="InnerItemsPresenter"
  23.                                 <ItemsPresenter.RenderTransform> 
  24.                                     <CompositeTransform/> 
  25.                                 </ItemsPresenter.RenderTransform> 
  26.                             </ItemsPresenter> 
  27.                         </Border> 
  28.                         <ListBox VerticalAlignment="Bottom" 
  29.                                  HorizontalAlignment="Center" 
  30.                                  x:Name="listMasker" 
  31.                                  ItemsSource="{TemplateBinding MarkSource}"
  32.                             <ListBox.ItemsPanel> 
  33.                                 <ItemsPanelTemplate> 
  34.                                     <VirtualizingStackPanel Orientation="Horizontal" /> 
  35.                                 </ItemsPanelTemplate> 
  36.                             </ListBox.ItemsPanel> 
  37.                             <ListBox.ItemTemplate> 
  38.                                 <DataTemplate> 
  39.                                     <Ellipse Margin="0 0 4 12" 
  40.                                              Width="8" 
  41.                                              Height="8" 
  42.                                              Tag="{Binding MarkIndex}"
  43.                                     </Ellipse> 
  44.                                 </DataTemplate> 
  45.                             </ListBox.ItemTemplate> 
  46.                         </ListBox> 
  47.                     </Grid> 
  48.                 </ControlTemplate> 
  49.             </Setter.Value> 
  50.         </Setter> 
  51.     </Style> 

顏色轉(zhuǎn)換器

  1. public class SlideViewMarkColorConverter : IValueConverter 
  2.     { 
  3.         private SolidColorBrush brush = new SolidColorBrush(); 
  4.         public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) 
  5.         { 
  6.             if ((int)value == (int)parameter) 
  7.             { 
  8.                 brush.Opacity = 1
  9.                 brush.Color = Colors.White; 
  10.             } 
  11.             else  
  12.             { 
  13.                 brush.Opacity = 0.4
  14.                 brush.Color = Colors.Black; 
  15.             } 
  16.             return brush; 
  17.         } 
  18.  
  19.         public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) 
  20.         { 
  21.             throw new NotImplementedException(); 
  22.         } 
  23.     } 

MarkSource綁定實體,其中MarkIndex修改為實體的sn,如果實體數(shù)量大于1 ItemsSource前insert***一個 ItemsSource后add***個。

***如果將控件放在樞軸里面 是無法滑動的。

在頁面后置代碼loadevent里面加上

  1. slideview.UseOptimizedManipulationRouting = false
  2.             slideview.AddHandler(PivotItem.ManipulationStartedEvent, new EventHandler<ManipulationStartedEventArgs>(myPivotItem_ManipulationStarted), true); 
  3.             slideview.AddHandler(PivotItem.ManipulationDeltaEvent, new EventHandler<ManipulationDeltaEventArgs>(myPivotItem_ManipulationDelta), true); 
  4.             slideview.AddHandler(PivotItem.ManipulationCompletedEvent, new EventHandler<ManipulationCompletedEventArgs>(myPivotItem_ManipulationCompleted), true); 
myPivotItem_ManipulationStarted
myPivotItem_ManipulationDelta
myPivotItem_ManipulationCompleted 事件里面判斷
  1. if (e.OriginalSource.GetType() == typeof(Image)) 
  2.             { 
  3.                 e.Handled = true
  4.             } 

本文鏈接:http://www.cnblogs.com/dingge38/archive/2014/08/01/3884716.html

責(zé)任編輯:chenqingxiang 來源: 戴眼鏡的殺手博客
相關(guān)推薦

2013-12-18 11:17:00

微軟WP

2014-04-15 10:40:34

WP8.1Build2014

2014-07-16 09:15:44

Android LiOS 8WP8.1

2013-03-27 10:12:29

Intel固態(tài)硬盤路線圖

2014-08-06 09:26:14

Windows Pho

2021-08-04 07:02:25

Windows 11操作系統(tǒng)微軟

2019-01-23 11:17:22

電腦程序員工作

2014-06-25 15:14:29

WP 8.1

2015-11-09 17:01:45

AfterShokz

2015-12-03 11:45:31

PHP7 發(fā)布

2014-04-14 11:23:27

WP8.1Build2014

2013-03-13 15:51:44

2013-10-18 09:25:56

Windows 8.1Windows

2021-01-29 09:07:39

數(shù)據(jù)保護(hù)信息安全數(shù)據(jù)隱私

2023-08-03 08:42:24

2018-11-23 10:58:17

黑五數(shù)據(jù)泄露數(shù)據(jù)保護(hù)

2023-11-30 12:07:21

人工智能CIO

2015-10-21 16:11:39

WP支付寶

2014-10-15 16:47:31

Android微軟

2014-09-01 10:56:52

WP8
點贊
收藏

51CTO技術(shù)棧公眾號