当前位置: 首页 > news >正文

权威解读当前经济热点问题什么是seo?

权威解读当前经济热点问题,什么是seo?,天津河西做网站哪家好,网站开发团队成员介绍前言 最近在和其他软件联合做一个本地图片选择传输功能,为此希望图片能够有序的呈现在客户端,简单的实现了一下功能,通过Mvvm模式进行呈现,过程简单通俗,话不多说直接上图。 处理过程 前台代码 你只需要粘贴到你的前台…

前言

        最近在和其他软件联合做一个本地图片选择传输功能,为此希望图片能够有序的呈现在客户端,简单的实现了一下功能,通过Mvvm模式进行呈现,过程简单通俗,话不多说直接上图。

处理过程

 前台代码

  1. 你只需要粘贴到你的前台xml中就可以,位置记得调整下Margin,我这是按照我的位置进行调整的,所以针对ListBox在你的前台你还需要调整下。
    <ListBox Name="lstFileManager" Background ="Transparent" ItemsSource="{Binding}" ScrollViewer.HorizontalScrollBarVisibility="Disabled" ScrollViewer.VerticalScrollBarVisibility="Auto" ScrollViewer.CanContentScroll="True" Margin="69,192,50,40"><ListBox.ItemsPanel><ItemsPanelTemplate><WrapPanel/></ItemsPanelTemplate></ListBox.ItemsPanel><ListBox.ItemTemplate><DataTemplate><!--这里修改内容整体大小以及在你框内的占比,我这一行显示5个--><Grid Margin="17" Width="100" Height="155"><Grid.RowDefinitions><RowDefinition Height="Auto" ></RowDefinition><RowDefinition Height="Auto" ></RowDefinition><RowDefinition Height="Auto" ></RowDefinition></Grid.RowDefinitions><Image Source="{Binding Pic}" HorizontalAlignment="Center" VerticalAlignment="Center" Width="100" Height="100"/><Border BorderThickness="1" BorderBrush="red" Margin="1,107,1,0"/><TextBlock Text="{Binding Name}" Grid.Row="1" Foreground="White" VerticalAlignment="Center" HorizontalAlignment="Center" Height="Auto" TextWrapping="Wrap"/></Grid></DataTemplate></ListBox.ItemTemplate>
    </ListBox>

后台代码

  1. 创建一个类进行数据绑定
        public class LVData{public string Name { get; set; }public BitmapImage Pic { get; set; }}
  2. 定义一个集合进行数据缓存 (集合定义在MainWindow的类中)
    ObservableCollection<LVData> LVDatas = new ObservableCollection<LVData>();
  3. 在我们的逻辑中进行数据填充和呈现,清除集合清空ListBox中的Item显示
    //添加图
    LVDatas.Add(new LVData { Name = "图片在ListBox中显示的名称(建议直接显示图片名称)", Pic = new BitmapImage(new Uri("完整的图片路径")) });
    //显示在ListBox中
    lstFileManager.ItemsSource = LVDatas;
    //清除集合清空呈现
    LVDatas.Clear();
    //当前点击的图片名称(lstFileManager.SelectedIndex  这是目前点击的下标)
    Console.WriteLine(LVDatas[lstFileManager.SelectedIndex].Name);
  4. 整体代码
    using System;
    using System.Collections.Generic;
    using System.Collections.ObjectModel;
    using System.IO;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    using System.Windows;
    using System.Windows.Controls;
    using System.Windows.Data;
    using System.Windows.Documents;
    using System.Windows.Input;
    using System.Windows.Media;
    using System.Windows.Media.Imaging;
    using System.Windows.Navigation;
    using System.Windows.Shapes;namespace ImageTexture
    {/// <summary>/// MainWindow.xaml 的交互逻辑/// </summary>public partial class MainWindow : Window{//定义集合ObservableCollection<LVData> LVDatas = new ObservableCollection<LVData>();public MainWindow(){InitializeComponent();ImageTexture2DView("E:\\ProjectFiles\\ImageTexture");}private void ImageTexture2DView(string path){//Path是图片所在的文件夹路径var apps = System.IO.Directory.GetFiles(path);List<string> images = new List<string>();foreach (string app in apps)//---遍历文件夹所有文件{var fi = new FileInfo(app);//---使用FileInfo类进行操作if (fi.Extension == ".png"){//将图片添加到LVData中LVDatas.Add(new LVData { Name = fi.Name.Remove(fi.Name.LastIndexOf(".")), Pic = new BitmapImage(new Uri(fi.FullName)) });}}//进行呈现lstFileManager.ItemsSource = LVDatas;}private void ImageClear_Click(object sender, RoutedEventArgs e){//清除集合清空ListBox中的Item显示LVDatas.Clear();}}public class LVData{public string Name { get; set; }public BitmapImage Pic { get; set; }}
    }
    

结局    

后续想从数据库或者其他地方添加就根据自己的想法添加就可以了,另外获取点击的是哪个绑定个监听事件就可以了,希望对大家有帮助。

http://www.ds6.com.cn/news/102857.html

相关文章:

  • 建个网站做网络推广要花多少钱百度竞价排名费用
  • 北京 做网站 公司培训机构seo
  • 如何做公司自己的网站中国制造网外贸平台
  • 网站icp备案号查询青岛网站建设策划
  • 自己做局域网站关键词搜索量查询工具
  • 日照哪里做网站视频推广一条多少钱
  • 手机网站页面设计外贸营销型网站
  • 政府新闻网站建设方案百度站长统计工具
  • 做一个模板网站多少钱北京seo公司哪家好
  • 小说网站怎么做原创色盲测试图片60张
  • 沈阳市网站建设哪里的公司比较好数据分析方法
  • 网站建设安排总结seo快速排名培训
  • 如何做网站宣传职业培训机构排名
  • 做网站项目体会北京网站制作建设公司
  • 北京网站建设价格关键词首页优化
  • 建设有访问量的网站餐饮营销案例100例
  • 音乐网站数据库怎么做seo内容优化是什么意思
  • 网站建设谈单情景对话网站如何做关键词优化
  • 手机派网站网站到首页排名
  • 流行网站设计申请一个网站
  • 企业网站建设综合实训心得体会一千字我是新手如何做电商
  • mac page wordpress深圳网站优化哪家好
  • 百度搜索引擎关键词seo关键词排名优化联系方式
  • 做网站的系统功能需求小程序seo推广技巧
  • 做免费网站沈阳seo排名公司
  • 长沙网站建设服务公司推广专员
  • 有哪些做实验的参考网站网络营销的特点主要包括什么
  • 公司做网站的意义网络营销推广方案策划书
  • 如果查询网站内页的收录情况最近爆发什么病毒感染
  • 日本男女直接做的视频网站小程序开发需要哪些技术