[源码下载]

重新想象 Windows 8 Store Apps (40) - 剪切板: 复制/粘贴文本, html, 图片, 文件

作者:webabcd

介绍
重新想象 Windows 8 Store Apps 之 剪切板

  • Clipboard - 剪切板
  • 复制/粘贴文本
  • 复制/粘贴html
  • 复制/粘贴图片
  • 复制/粘贴文件

示例
1、演示剪切板的基本应用
Clipboard/Demo.xaml

  1. <Page
  2. x:Class="XamlDemo.Clipboard.Demo"
  3. xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  4. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  5. xmlns:local="using:XamlDemo.Clipboard"
  6. xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
  7. xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
  8. mc:Ignorable="d">
  9.  
  10. <Grid Background="Transparent">
  11. <StackPanel Margin="120 0 0 0">
  12.  
  13. <TextBlock Name="lblMsg" FontSize="14.667" />
  14.  
  15. <Button Name="btnCopyText" Content="复制一段文本到剪切板" Click="btnCopyText_Click_1" Margin="0 10 0 0" />
  16.  
  17. <Button Name="btnPasteText" Content="粘贴剪切板中的文本" Click="btnPasteText_Click_1" Margin="0 10 0 0" />
  18.  
  19. <Button Name="btnShowAvailableFormats" Content="获取剪切板中包含的数据的格式类型" Click="btnShowAvailableFormats_Click_1" Margin="0 10 0 0" />
  20.  
  21. <Button Name="btnClear" Content="清除剪切板中的全部内容" Click="btnClear_Click_1" Margin="0 10 0 0" />
  22.  
  23. </StackPanel>
  24. </Grid>
  25. </Page>

Clipboard/Demo.xaml.cs

  1. /*
  2. * Clipboard - 剪切板
  3. * SetContent() - 将指定的 DataPackage 存入剪切板
  4. * GetContent() - 从剪切板中获取 DataPackage 对象
  5. * Clear() - 清除剪切板中的全部数据
  6. * Flush() - 正常情况下,关闭 app 后,此 app 保存到剪切板的数据就会消失;调用此方法后,即使关闭 app,剪切板中的数据也不会消失
  7. * ContentChanged - 剪切板中的数据发生变化时所触发的事件
  8. *
  9. * DataPackage - 用于封装 Clipboard 或 ShareContract 的数据(详细说明见 ShareContract 的 Demo)
  10. * SetText(), SetUri(), SetHtmlFormat(), SetRtf(), SetBitmap(), SetStorageItems(), SetData(), SetDataProvider() - 设置复制到剪切板的各种格式的数据(注:一个 DataPackage 可以有多种不同格式的数据)
  11. * RequestedOperation - 操作类型(DataPackageOperation 枚举: None, Copy, Move, Link),没发现此属性有任何作用
  12. *
  13. * DataPackageView - DataPackage 对象的只读版本,从剪切板获取数据或者共享目标接收数据均通过此对象来获取 DataPackage 对象的数据(详细说明见 ShareContract 的 Demo)
  14. */
  15.  
  16. using System;
  17. using Windows.ApplicationModel.DataTransfer;
  18. using Windows.UI.Xaml;
  19. using Windows.UI.Xaml.Controls;
  20. using Windows.UI.Xaml.Navigation;
  21.  
  22. namespace XamlDemo.Clipboard
  23. {
  24. public sealed partial class Demo : Page
  25. {
  26. public Demo()
  27. {
  28. this.InitializeComponent();
  29. }
  30.  
  31. protected override void OnNavigatedTo(NavigationEventArgs e)
  32. {
  33. Windows.ApplicationModel.DataTransfer.Clipboard.ContentChanged += Clipboard_ContentChanged;
  34. }
  35.  
  36. protected override void OnNavigatedFrom(NavigationEventArgs e)
  37. {
  38. Windows.ApplicationModel.DataTransfer.Clipboard.ContentChanged -= Clipboard_ContentChanged;
  39. }
  40.  
  41. void Clipboard_ContentChanged(object sender, object e)
  42. {
  43. lblMsg.Text += Environment.NewLine;
  44. lblMsg.Text += "剪切板中的内容发生了变化";
  45. }
  46.  
  47. // 复制一段文本到剪切板
  48. private void btnCopyText_Click_1(object sender, RoutedEventArgs e)
  49. {
  50. // 构造保存到剪切板的 DataPackage 对象
  51. DataPackage dataPackage = new DataPackage();
  52. dataPackage.SetText("I am webabcd: " + DateTime.Now.ToString());
  53.  
  54. try
  55. {
  56. Windows.ApplicationModel.DataTransfer.Clipboard.SetContent(dataPackage); // 保存 DataPackage 对象到剪切板
  57. Windows.ApplicationModel.DataTransfer.Clipboard.Flush(); // 当此 app 关闭后,依然保留剪切板中的数据
  58. lblMsg.Text = "已将内容复制到剪切板";
  59. }
  60. catch (Exception ex)
  61. {
  62. lblMsg.Text = ex.ToString();
  63. }
  64. }
  65.  
  66. // 显示剪切板中的文本数据
  67. private async void btnPasteText_Click_1(object sender, RoutedEventArgs e)
  68. {
  69. // 获取剪切板中的数据
  70. DataPackageView dataPackageView = Windows.ApplicationModel.DataTransfer.Clipboard.GetContent();
  71.  
  72. // 如果剪切板中有文本数据,则获取并显示该文本
  73. if (dataPackageView.Contains(StandardDataFormats.Text))
  74. {
  75. try
  76. {
  77. string text = await dataPackageView.GetTextAsync();
  78. lblMsg.Text = text;
  79. }
  80. catch (Exception ex)
  81. {
  82. lblMsg.Text = ex.ToString();
  83. }
  84. }
  85. else
  86. {
  87. lblMsg.Text = "剪切板中无文本内容";
  88. }
  89. }
  90.  
  91. // 显示剪切板中包含的数据的格式类型,可能会有 StandardDataFormats 枚举的格式,也可能会有自定义的格式(关于自定义格式可以参见:ShareContract 的 Demo)
  92. private void btnShowAvailableFormats_Click_1(object sender, RoutedEventArgs e)
  93. {
  94. DataPackageView dataPackageView = Windows.ApplicationModel.DataTransfer.Clipboard.GetContent();
  95. if (dataPackageView != null && dataPackageView.AvailableFormats.Count > )
  96. {
  97. var availableFormats = dataPackageView.AvailableFormats.GetEnumerator();
  98. while (availableFormats.MoveNext())
  99. {
  100. lblMsg.Text += Environment.NewLine;
  101. lblMsg.Text += availableFormats.Current;
  102. }
  103. }
  104. else
  105. {
  106. lblMsg.Text = "剪切板中无任何内容";
  107. }
  108. }
  109.  
  110. // 清除剪切板中的全部数据
  111. private void btnClear_Click_1(object sender, RoutedEventArgs e)
  112. {
  113. Windows.ApplicationModel.DataTransfer.Clipboard.Clear();
  114. }
  115. }
  116. }

2、演示如何复制 html 数据到剪切板,以及如何从剪切板中获取 html 数据 
Clipboard/CopyHtml.xaml

  1. <Page
  2. x:Class="XamlDemo.Clipboard.CopyHtml"
  3. xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  4. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  5. xmlns:local="using:XamlDemo.Clipboard"
  6. xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
  7. xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
  8. mc:Ignorable="d">
  9.  
  10. <Grid Background="Transparent">
  11. <StackPanel Margin="120 0 0 0">
  12.  
  13. <TextBlock Name="lblMsg" FontSize="14.667" />
  14.  
  15. <Button Name="btnCopyHtml" Content="复制一段 html 到剪切板" Click="btnCopyHtml_Click_1" Margin="0 10 0 0" />
  16.  
  17. <Button Name="btnPasteHtml" Content="粘贴剪切板中的 html" Click="btnPasteHtml_Click_1" Margin="0 10 0 0" />
  18.  
  19. </StackPanel>
  20. </Grid>
  21. </Page>

Clipboard/CopyHtml.xaml.cs

  1. /*
  2. * 演示如何复制 html 数据到剪切板,以及如何从剪切板中获取 html 数据
  3. *
  4. * HtmlFormatHelper - 在 Clipboard 中传递 html 数据或在 ShareContract 中传递 html 数据时的帮助类
  5. * CreateHtmlFormat() - 封装需要传递的 html 字符串,以便以 html 方式传递数据
  6. * GetStaticFragment() - 解封装传递过来的经过封装的 html 数据,从而获取初始需要传递的 html 字符串
  7. */
  8.  
  9. using System;
  10. using Windows.ApplicationModel.DataTransfer;
  11. using Windows.UI.Xaml;
  12. using Windows.UI.Xaml.Controls;
  13.  
  14. namespace XamlDemo.Clipboard
  15. {
  16. public sealed partial class CopyHtml : Page
  17. {
  18. public CopyHtml()
  19. {
  20. this.InitializeComponent();
  21. }
  22.  
  23. // 复制 html 字符串到剪切板
  24. private void btnCopyHtml_Click_1(object sender, RoutedEventArgs e)
  25. {
  26. DataPackage dataPackage = new DataPackage();
  27. // 封装一下需要复制的 html 数据,以便以 html 的方式将数据复制到剪切板
  28. string htmlFormat = HtmlFormatHelper.CreateHtmlFormat("<body>I am webabcd</body>");
  29. dataPackage.SetHtmlFormat(htmlFormat);
  30.  
  31. try
  32. {
  33. Windows.ApplicationModel.DataTransfer.Clipboard.SetContent(dataPackage);
  34. lblMsg.Text = "已将内容复制到剪切板";
  35. }
  36. catch (Exception ex)
  37. {
  38. lblMsg.Text = ex.ToString();
  39. }
  40. }
  41.  
  42. // 显示剪切板中的 html 数据
  43. private async void btnPasteHtml_Click_1(object sender, RoutedEventArgs e)
  44. {
  45. DataPackageView dataPackageView = Windows.ApplicationModel.DataTransfer.Clipboard.GetContent();
  46.  
  47. if (dataPackageView.Contains(StandardDataFormats.Html))
  48. {
  49. try
  50. {
  51. // 封装后的数据
  52. string htmlFormat = await dataPackageView.GetHtmlFormatAsync();
  53. // 封装前的数据
  54. string htmlFragment = HtmlFormatHelper.GetStaticFragment(htmlFormat);
  55.  
  56. lblMsg.Text = "htmlFormat(封装后的数据): ";
  57. lblMsg.Text += Environment.NewLine;
  58. lblMsg.Text += htmlFormat;
  59. lblMsg.Text += Environment.NewLine;
  60. lblMsg.Text += Environment.NewLine;
  61. lblMsg.Text += "htmlFragment(封装前的数据): ";
  62. lblMsg.Text += Environment.NewLine;
  63. lblMsg.Text += htmlFragment;
  64. }
  65. catch (Exception ex)
  66. {
  67. lblMsg.Text = ex.ToString();
  68. }
  69. }
  70. else
  71. {
  72. lblMsg.Text = "剪切板中无 html 内容";
  73. }
  74. }
  75. }
  76. }

3、演示如何复制图片内容剪切板,以及如何从剪切板中获取图片内容,以及数据的延迟复制
Clipboard/CopyImage.xaml

  1. <Page
  2. x:Class="XamlDemo.Clipboard.CopyImage"
  3. xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  4. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  5. xmlns:local="using:XamlDemo.Clipboard"
  6. xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
  7. xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
  8. mc:Ignorable="d">
  9.  
  10. <Grid Background="Transparent">
  11. <StackPanel Margin="120 0 0 0">
  12.  
  13. <TextBlock Name="lblMsg" FontSize="14.667" />
  14. <Image Name="imgBitmap" Stretch="None" HorizontalAlignment="Left" Margin="0 10 0 0" />
  15.  
  16. <Button Name="btnCopyImage" Content="复制图片内容到剪切板" Click="btnCopyImage_Click_1" Margin="0 10 0 0" />
  17.  
  18. <Button Name="btnCopyImageWithDeferral" Content="复制数据提供器到剪切板,当“粘贴”操作被触发时由数据提供器生成用于粘贴的图片数据" Click="btnCopyImageWithDeferral_Click_1" Margin="0 10 0 0" />
  19.  
  20. <Button Name="btnPasteImage" Content="粘贴剪切板中的图片内容" Click="btnPasteImage_Click_1" Margin="0 10 0 0" />
  21.  
  22. </StackPanel>
  23. </Grid>
  24. </Page>

Clipboard/CopyImage.xaml.cs

  1. /*
  2. * 1、演示如何复制图片内容剪切板,以及如何从剪切板中获取图片内容
  3. * 2、演示如何通过 SetDataProvider() 延迟数据的复制,即在“粘贴”操作触发后由数据提供器生成相关数据
  4. */
  5.  
  6. using System;
  7. using Windows.ApplicationModel.DataTransfer;
  8. using Windows.Graphics.Imaging;
  9. using Windows.Storage;
  10. using Windows.Storage.Streams;
  11. using Windows.UI.Core;
  12. using Windows.UI.Xaml;
  13. using Windows.UI.Xaml.Controls;
  14. using Windows.UI.Xaml.Media.Imaging;
  15.  
  16. namespace XamlDemo.Clipboard
  17. {
  18. public sealed partial class CopyImage : Page
  19. {
  20. public CopyImage()
  21. {
  22. this.InitializeComponent();
  23. }
  24.  
  25. // 复制图片内容到剪切板
  26. private void btnCopyImage_Click_1(object sender, RoutedEventArgs e)
  27. {
  28. DataPackage dataPackage = new DataPackage();
  29. dataPackage.SetBitmap(RandomAccessStreamReference.CreateFromUri(new Uri("ms-appx:///Assets/Logo.png", UriKind.Absolute)));
  30.  
  31. try
  32. {
  33. Windows.ApplicationModel.DataTransfer.Clipboard.SetContent(dataPackage);
  34. lblMsg.Text = "已将内容复制到剪切板";
  35. }
  36. catch (Exception ex)
  37. {
  38. lblMsg.Text = ex.ToString();
  39. }
  40. }
  41.  
  42. // 延迟复制
  43. private async void btnCopyImageWithDeferral_Click_1(object sender, RoutedEventArgs e)
  44. {
  45. StorageFile imageFile = await StorageFile.GetFileFromApplicationUriAsync(new Uri("ms-appx:///Assets/Logo.png", UriKind.Absolute));
  46.  
  47. DataPackage dataPackage = new DataPackage();
  48. dataPackage.SetDataProvider(StandardDataFormats.Bitmap, async (request) =>
  49. {
  50. /*
  51. * 当从剪切板中获取 StandardDataFormats.Bitmap 数据时,会执行到此处以提供相关数据
  52. */
  53.  
  54. if (imageFile != null)
  55. {
  56. // 开始异步处理
  57. var deferral = request.GetDeferral();
  58.  
  59. try
  60. {
  61. using (var imageStream = await imageFile.OpenAsync(FileAccessMode.Read))
  62. {
  63. // 将图片缩小一倍
  64. BitmapDecoder imageDecoder = await BitmapDecoder.CreateAsync(imageStream);
  65. var inMemoryStream = new InMemoryRandomAccessStream();
  66. var imageEncoder = await BitmapEncoder.CreateForTranscodingAsync(inMemoryStream, imageDecoder);
  67. imageEncoder.BitmapTransform.ScaledWidth = (uint)(imageDecoder.OrientedPixelWidth * 0.5);
  68. imageEncoder.BitmapTransform.ScaledHeight = (uint)(imageDecoder.OrientedPixelHeight * 0.5);
  69. await imageEncoder.FlushAsync();
  70.  
  71. // 指定需要复制到剪切板的数据
  72. request.SetData(RandomAccessStreamReference.CreateFromStream(inMemoryStream));
  73.  
  74. await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
  75. {
  76. lblMsg.Text = "数据已生成";
  77. });
  78. }
  79. }
  80. finally
  81. {
  82. // 通知系统已完成异步操作
  83. deferral.Complete();
  84. }
  85. }
  86. });
  87.  
  88. try
  89. {
  90. Windows.ApplicationModel.DataTransfer.Clipboard.SetContent(dataPackage);
  91. lblMsg.Text = "已将数据提供器复制到剪切板,在“粘贴”操作时才会生成数据";
  92. }
  93. catch (Exception ex)
  94. {
  95. lblMsg.Text = ex.ToString();
  96. }
  97. }
  98.  
  99. // 显示剪切板中的图片内容
  100. private async void btnPasteImage_Click_1(object sender, RoutedEventArgs e)
  101. {
  102. DataPackageView dataPackageView = Windows.ApplicationModel.DataTransfer.Clipboard.GetContent();
  103.  
  104. if (dataPackageView.Contains(StandardDataFormats.Bitmap))
  105. {
  106. try
  107. {
  108. IRandomAccessStreamReference randomStream = await dataPackageView.GetBitmapAsync();
  109. if (randomStream != null)
  110. {
  111. using (IRandomAccessStreamWithContentType imageStream = await randomStream.OpenReadAsync())
  112. {
  113. BitmapImage bitmapImage = new BitmapImage();
  114. bitmapImage.SetSource(imageStream);
  115. imgBitmap.Source = bitmapImage;
  116. }
  117. }
  118. }
  119. catch (Exception ex)
  120. {
  121. lblMsg.Text = ex.ToString();
  122. }
  123. }
  124. else
  125. {
  126. lblMsg.Text = "剪切板中无 bitmap 内容";
  127. }
  128. }
  129. }
  130. }

4、演示如何复制指定的文件到剪切板,以及如何从剪切板中获取文件并保存到指定的路径
Clipboard/CopyFile.xaml

  1. <Page
  2. x:Class="XamlDemo.Clipboard.CopyFile"
  3. xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  4. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  5. xmlns:local="using:XamlDemo.Clipboard"
  6. xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
  7. xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
  8. mc:Ignorable="d">
  9.  
  10. <Grid Background="Transparent">
  11. <StackPanel Margin="120 0 0 0">
  12.  
  13. <TextBlock Name="lblMsg" FontSize="14.667" TextWrapping="Wrap" Margin="0 0 10 0" />
  14.  
  15. <Button Name="btnCopyFile" Content="复制一个文件到剪切板" Click="btnCopyFile_Click_1" Margin="0 10 0 0" />
  16.  
  17. <Button Name="btnPasteFile" Content="粘贴剪切板中的文件到指定的路径" Click="btnPasteFile_Click_1" Margin="0 10 0 0" />
  18.  
  19. </StackPanel>
  20. </Grid>
  21. </Page>

Clipboard/CopyFile.xaml.cs

  1. /*
  2. * 演示如何复制指定的文件到剪切板,以及如何从剪切板中获取文件并保存到指定的路径
  3. */
  4.  
  5. using System;
  6. using System.Linq;
  7. using System.Collections.Generic;
  8. using Windows.ApplicationModel.DataTransfer;
  9. using Windows.Storage;
  10. using Windows.UI.Xaml;
  11. using Windows.UI.Xaml.Controls;
  12.  
  13. namespace XamlDemo.Clipboard
  14. {
  15. public sealed partial class CopyFile : Page
  16. {
  17. public CopyFile()
  18. {
  19. this.InitializeComponent();
  20. }
  21.  
  22. // 保存文件到剪切板
  23. private async void btnCopyFile_Click_1(object sender, RoutedEventArgs e)
  24. {
  25. StorageFile file = await ApplicationData.Current.LocalFolder.CreateFileAsync(@"webabcdTest\clipboard.txt", CreationCollisionOption.ReplaceExisting);
  26. await FileIO.WriteTextAsync(file, "I am webabcd: " + DateTime.Now.ToString());
  27.  
  28. DataPackage dataPackage = new DataPackage();
  29. dataPackage.SetStorageItems(new List<StorageFile>() { file });
  30.  
  31. dataPackage.RequestedOperation = DataPackageOperation.Move;
  32. try
  33. {
  34. Windows.ApplicationModel.DataTransfer.Clipboard.SetContent(dataPackage);
  35. lblMsg.Text = "已将文件复制到剪切板";
  36. }
  37. catch (Exception ex)
  38. {
  39. lblMsg.Text = ex.ToString();
  40. }
  41. }
  42.  
  43. // 从剪切板中获取文件并保存到指定的路径
  44. private async void btnPasteFile_Click_1(object sender, RoutedEventArgs e)
  45. {
  46. DataPackageView dataPackageView = Windows.ApplicationModel.DataTransfer.Clipboard.GetContent();
  47.  
  48. if (dataPackageView.Contains(StandardDataFormats.StorageItems))
  49. {
  50. try
  51. {
  52. IReadOnlyList<IStorageItem> storageItems = await dataPackageView.GetStorageItemsAsync();
  53. StorageFile file = storageItems.First() as StorageFile;
  54. if (file != null)
  55. {
  56. StorageFile newFile = await file.CopyAsync(ApplicationData.Current.TemporaryFolder, file.Name, NameCollisionOption.ReplaceExisting);
  57. if (newFile != null)
  58. {
  59. lblMsg.Text = string.Format("已将文件从{0}复制到{1}", file.Path, newFile.Path);
  60. }
  61. }
  62. }
  63. catch (Exception ex)
  64. {
  65. lblMsg.Text = ex.ToString();
  66. }
  67. }
  68. else
  69. {
  70. lblMsg.Text = "剪切板中无 StorageItems 内容";
  71. }
  72. }
  73. }
  74. }

OK
[源码下载]

重新想象 Windows 8 Store Apps (40) - 剪切板: 复制/粘贴文本, html, 图片, 文件的更多相关文章

  1. 重新想象 Windows 8 Store Apps 系列文章索引

    [源码下载][重新想象 Windows 8.1 Store Apps 系列文章] 重新想象 Windows 8 Store Apps 系列文章索引 作者:webabcd 1.重新想象 Windows ...

  2. 重新想象 Windows 8 Store Apps (23) - 文件系统: 文本的读写, 二进制的读写, 流的读写, 最近访问列表和未来访问列表

    原文:重新想象 Windows 8 Store Apps (23) - 文件系统: 文本的读写, 二进制的读写, 流的读写, 最近访问列表和未来访问列表 [源码下载] 重新想象 Windows 8 S ...

  3. 重新想象 Windows 8 Store Apps (37) - 契约: Settings Contract

    [源码下载] 重新想象 Windows 8 Store Apps (37) - 契约: Settings Contract 作者:webabcd 介绍重新想象 Windows 8 Store Apps ...

  4. 重新想象 Windows 8 Store Apps (39) - 契约: Share Contract

    [源码下载] 重新想象 Windows 8 Store Apps (39) - 契约: Share Contract 作者:webabcd 介绍重新想象 Windows 8 Store Apps 之  ...

  5. 重新想象 Windows 8 Store Apps (51) - 输入: 涂鸦板

    [源码下载] 重新想象 Windows 8 Store Apps (51) - 输入: 涂鸦板 作者:webabcd 介绍重新想象 Windows 8 Store Apps 之 涂鸦板 通过 Poin ...

  6. 重新想象 Windows 8 Store Apps (12) - 控件之 GridView 特性: 拖动项, 项尺寸可变, 分组显示

    原文:重新想象 Windows 8 Store Apps (12) - 控件之 GridView 特性: 拖动项, 项尺寸可变, 分组显示 [源码下载] 重新想象 Windows 8 Store Ap ...

  7. 重新想象 Windows 8 Store Apps (8) - 控件之 WebView

    原文:重新想象 Windows 8 Store Apps (8) - 控件之 WebView [源码下载] 重新想象 Windows 8 Store Apps (8) - 控件之 WebView 作者 ...

  8. 重新想象 Windows 8 Store Apps (5) - 控件之集合控件: ComboBox, ListBox, FlipView, ItemsControl, ItemsPresenter

    原文:重新想象 Windows 8 Store Apps (5) - 控件之集合控件: ComboBox, ListBox, FlipView, ItemsControl, ItemsPresente ...

  9. 重新想象 Windows 8 Store Apps (34) - 通知: Toast Demo, Tile Demo, Badge Demo

    [源码下载] 重新想象 Windows 8 Store Apps (34) - 通知: Toast Demo, Tile Demo, Badge Demo 作者:webabcd 介绍重新想象 Wind ...

随机推荐

  1. 【分享】分享一个压缩 PNG 的网站 TinyPNG

    TinyPNG 能做什么? TinyPNG 采用智能的有损压缩技术来减少你的 PNG 文件的文件大小.通过选择性地减少图像中的颜色数量,更少的字节用于存储数据.效果几乎是看不见的,但它在文件大小方面差 ...

  2. c# -- 对象销毁和垃圾回收

    有些对象需要显示地销毁代码来释放资源,比如打开的文件资源,锁,操作系统句柄和非托管对象.在.NET中,这就是所谓的对象销毁,它通过IDisposal接口来实现.不再使用的对象所占用的内存管理,必须在某 ...

  3. C#集合-列举(Enumeration)

    在计算机这个范畴内存在许多种类的集合,从简单的数据结构比如数组.链表,到复杂的数据结构比如红黑树,哈希表.尽管这些数据结构的内部实现和外部特征大相径庭,但是遍历集合的内容确是一个共同的需求..NET ...

  4. 气球或者泡泡向上飘动 jQuery插件

    圣诞.元旦要来了,公司以往基本每个月至少要搞一两款手机小游戏来宣传产品,这次也不例外!! 之前做过,按压柚子.许愿.吃柚子等等小游戏,这次是做个那种 气球向上飘动,戳破气球,随机获取奖品.如下图: 手 ...

  5. Spark源码系列(九)Spark SQL初体验之解析过程详解

    好久没更新博客了,之前学了一些R语言和机器学习的内容,做了一些笔记,之后也会放到博客上面来给大家共享.一个月前就打算更新Spark Sql的内容了,因为一些别的事情耽误了,今天就简单写点,Spark1 ...

  6. postgresql 获取刚刚插入的数据主键id

    postgresql不支持last_insert_id()方法,恶心到啦: 不过还好它有其他的解决方案: 创建一个测试数据表: CREATE TABLE test.test18 ( id serial ...

  7. [LeetCode] Range Sum Query 2D - Immutable

    Very similar to Range Sum Query - Immutable, but we now need to compute a 2d accunulated-sum. In fac ...

  8. (转)2G到C-RAN网络架构的演进

    这是我一个学霸师弟写的一篇知识普及的文章,涉及到的知识结构很全面,很丰富,对网络通信技术感兴趣的童鞋可以看看,内容我就不贴过来了,直接到他博客上去看吧. 2G到C-RAN网络结构演进

  9. CLR via C#深解笔记五 - 事件

    事件处理实际上是一种具有特殊签名的delegate, 像这个样子:public delegate void EventHandler(object sender, EventArgs e);   类型 ...

  10. 实现让Lync client也能够"潜水"隐身聊天

    看到MSN或QQ,都支持隐身聊天. Lync Server  2013也是支持的.   1.Server端:Lync 2013 Server 缺省策略是没有设置显示脱机功能.(设置前截图)   2.直 ...