国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁(yè) > 系統(tǒng) > Windows > 正文

Windows 8技巧:Windows 8中FlipView的使用技巧介紹

2019-11-28 03:38:21
字體:
來(lái)源:轉(zhuǎn)載
供稿:網(wǎng)友

  FlipView控件類似于翻頁(yè)控件,并且是現(xiàn)成的翻頁(yè)按鈕,你只需要為其增加數(shù)據(jù)項(xiàng)即可。本文講述兩種方式的FlipView項(xiàng)目和展示。

  一:直接前臺(tái)FlipViewItem

復(fù)制代碼
代碼如下:

<FlipView>
<FlipViewItem>
<Image Stretch="Uniform" Source="http://imgcache.qq.com/club/item/wallpic/items/2/3802/760_300_3802.jpg"/>
</FlipViewItem>
<FlipViewItem>
<Image Stretch="Uniform" Source="http://imgcache.qq.com/club/item/wallpic/items/3/4023/c_760_300_4023.jpg"/>
</FlipViewItem>
<FlipViewItem>
<Image Stretch="Uniform" Source="http://imgcache.qq.com/club/item/wallpic/items/3/3673/c_760_300_3673.jpg"/>
</FlipViewItem>
<FlipViewItem>
<Image Stretch="Uniform" Source="http://imgcache.qq.com/club/item/wallpic/items/7/4017/c_760_300_4017.jpg"/>
</FlipViewItem>
<FlipViewItem>
<Image Stretch="Uniform" Source="http://imgcache.qq.com/club/item/wallpic/items/2/3972/c_760_300_3972.jpg"/>
</FlipViewItem>
</FlipView>

  效果如下:

  二:前臺(tái)設(shè)置DataTemplate,后臺(tái)實(shí)體集方式添加數(shù)據(jù)項(xiàng)。

復(fù)制代碼
代碼如下:

<FlipView Name="fvShow" Margin="100">
<FlipView.ItemTemplate>
<DataTemplate>
<Grid>
<Grid.Background>
<ImageBrush Stretch="Uniform" ImageSource="{Binding ImgUrl}"/>
</Grid.Background>
<TextBlock Height="30" VerticalAlignment="Top" HorizontalAlignment="Left"
Margin="180 300 0 0" FontSize="20" Foreground="Blue" Text="{Binding ImgName}"/>
<TextBlock Height="30" VerticalAlignment="Top" HorizontalAlignment="Left"
Margin="180 350 0 0" FontSize="20" Foreground="Blue" Text="{Binding ImgAddr}"/>
</Grid>
</DataTemplate>
</FlipView.ItemTemplate>
</FlipView>


復(fù)制代碼
代碼如下:

/// <summary>
/// 可用于自身或?qū)Ш街?Frame 內(nèi)部的空白頁(yè)。
/// </summary>
public sealed partial class MainPage : Page
{
public MainPage()
{
this.InitializeComponent();
this.fvShow.ItemsSource = ImgModel.GetImgData();
}</p><p> /// <summary>
/// 在此頁(yè)將要在 Frame 中顯示時(shí)進(jìn)行調(diào)用。
/// </summary>
/// <param name="e">描述如何訪問(wèn)此頁(yè)的事件數(shù)據(jù)。Parameter
/// 屬性通常用于配置頁(yè)。</param>
protected override void OnNavigatedTo(NavigationEventArgs e)
{
}
}</p><p> /// <summary>
/// 圖片實(shí)體
/// </summary>
public class ImgModel
{
/// <summary>
/// 圖片名字
/// </summary>
public string ImgName { get; set; }</p><p> /// <summary>
/// 圖片地址
/// </summary>
public string ImgAddr { get; set; }</p><p> /// <summary>
/// 圖片URL
/// </summary>
public string ImgUrl { get; set; }</p><p> public static List<ImgModel> GetImgData()
{
List<ImgModel> list = new List<ImgModel>();
list.Add(new ImgModel() { ImgName = "名字:北京冬景", ImgAddr = "地址:北京市", ImgUrl = "http://imgcache.qq.com/club/item/wallpic/items/2/3922/760_300_3922.jpg" });
list.Add(new ImgModel() { ImgName = "名字:上海春景", ImgAddr = "地址:上海市", ImgUrl = "http://imgcache.qq.com/club/item/wallpic/items/7/3147/760_300_3147.jpg" });
list.Add(new ImgModel() { ImgName = "名字:天津秋景", ImgAddr = "地址:天津市", ImgUrl = "http://imgcache.qq.com/club/item/wallpic/items/6/3966/c_760_300_3966.jpg" });
list.Add(new ImgModel() { ImgName = "名字:海南夏景", ImgAddr = "地址:海南市", ImgUrl = "http://imgcache.qq.com/club/item/wallpic/items/5/3695/760_300_3695.jpg" });
list.Add(new ImgModel() { ImgName = "名字:成都風(fēng)景", ImgAddr = "地址:成都市", ImgUrl = "http://imgcache.qq.com/club/item/wallpic/items/8/2518/760_300_2518.jpg" });
return list;
}
}

  看此方式的效果如下:

  最后如需源碼請(qǐng)點(diǎn)擊 Win8FlipView_jb51net 下載。

發(fā)表評(píng)論 共有條評(píng)論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 东光县| 宁德市| 合水县| 县级市| 杭锦后旗| 宣威市| 温宿县| 康平县| 滦南县| 平南县| 望都县| 黑河市| 铁岭市| 昌图县| 宁明县| 廊坊市| 马龙县| 乌拉特前旗| 汉沽区| 根河市| 镇安县| 胶南市| 宁强县| 郑州市| 长宁县| 海晏县| 阿巴嘎旗| 诏安县| 嘉善县| 宁安市| 陈巴尔虎旗| 雷州市| 夏河县| 嘉义市| 林周县| 邵阳县| 娄烦县| 丰台区| 乐山市| 镇雄县| 龙州县|