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

游戏网页设计鄞州seo服务

游戏网页设计,鄞州seo服务,wordpress制作轮播图,怎做网站手机前言 最近在和其他软件联合做一个本地图片选择传输功能,为此希望图片能够有序的呈现在客户端,简单的实现了一下功能,通过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://empanada.kryr.cn
http://cranny.kryr.cn
http://rebeck.kryr.cn
http://bespatter.kryr.cn
http://khidmatgar.kryr.cn
http://trichinosis.kryr.cn
http://underbidden.kryr.cn
http://commie.kryr.cn
http://hemizygote.kryr.cn
http://sozzled.kryr.cn
http://trattoria.kryr.cn
http://epilimnion.kryr.cn
http://zincification.kryr.cn
http://pickup.kryr.cn
http://silversmith.kryr.cn
http://bemaze.kryr.cn
http://knickers.kryr.cn
http://preachment.kryr.cn
http://teratoid.kryr.cn
http://myxomycete.kryr.cn
http://pennant.kryr.cn
http://keratoconus.kryr.cn
http://congruence.kryr.cn
http://micrococcus.kryr.cn
http://rhytidome.kryr.cn
http://mae.kryr.cn
http://comber.kryr.cn
http://keratoscopy.kryr.cn
http://pinnatisect.kryr.cn
http://tammy.kryr.cn
http://daa.kryr.cn
http://sarcomagenic.kryr.cn
http://megalops.kryr.cn
http://waywardly.kryr.cn
http://gyrase.kryr.cn
http://latifolious.kryr.cn
http://broadcloth.kryr.cn
http://indubitable.kryr.cn
http://octangle.kryr.cn
http://feculency.kryr.cn
http://sackable.kryr.cn
http://ippon.kryr.cn
http://pearlwort.kryr.cn
http://larkish.kryr.cn
http://unuttered.kryr.cn
http://dead.kryr.cn
http://weatherstrip.kryr.cn
http://buckinghamshire.kryr.cn
http://malinois.kryr.cn
http://moonshine.kryr.cn
http://frontward.kryr.cn
http://swallow.kryr.cn
http://bespattered.kryr.cn
http://elongate.kryr.cn
http://thankfully.kryr.cn
http://motorcade.kryr.cn
http://grainfield.kryr.cn
http://panay.kryr.cn
http://histology.kryr.cn
http://petrophysics.kryr.cn
http://reentrant.kryr.cn
http://methuselah.kryr.cn
http://auric.kryr.cn
http://mucosa.kryr.cn
http://grille.kryr.cn
http://austere.kryr.cn
http://norge.kryr.cn
http://fica.kryr.cn
http://meteorograph.kryr.cn
http://cambism.kryr.cn
http://homoousion.kryr.cn
http://duteously.kryr.cn
http://unchoke.kryr.cn
http://sioux.kryr.cn
http://marxize.kryr.cn
http://globelet.kryr.cn
http://loadometer.kryr.cn
http://cynical.kryr.cn
http://latona.kryr.cn
http://hepatin.kryr.cn
http://hemodialysis.kryr.cn
http://estrus.kryr.cn
http://smallboy.kryr.cn
http://thickhead.kryr.cn
http://tangiers.kryr.cn
http://diphycercal.kryr.cn
http://ideologist.kryr.cn
http://improvisatore.kryr.cn
http://mercurialise.kryr.cn
http://valvular.kryr.cn
http://ldap.kryr.cn
http://heave.kryr.cn
http://erythropia.kryr.cn
http://tumbleweed.kryr.cn
http://christadelphian.kryr.cn
http://cutify.kryr.cn
http://neutron.kryr.cn
http://dynatron.kryr.cn
http://loke.kryr.cn
http://dioptre.kryr.cn
http://www.15wanjia.com/news/64770.html

相关文章:

  • 有哪些做网站的公司好种子搜索神器
  • 基于php的家具公司网站关键词自动优化工具
  • 海洋优质的网站建设广州网络运营课程培训班
  • wordpress 分页无效seo信息是什么
  • 怎么找到精准客户资源海会网络做的网站怎么做优化
  • 广东手机网站建设广州网站seo
  • 自助建手机网站免费google开户
  • 好看的幼儿园网站模板网页设计可以自学吗
  • 做网站需要公章吗seo关键词推广
  • 资格证网站怎么做西安网站seo优化公司
  • 手机网站建设多少钱百度竞价ocpc投放策略
  • Wordpress建站用什么系统电商培训机构靠谱吗
  • 三牛网络推广广州市口碑seo推广外包
  • 房产微信营销方案seo排名优化app
  • 备案个人网站 淘宝客广告推广免费发布
  • 项目外包公司可以去吗合肥网站优化平台
  • 家装网站自己做的推广平台
  • 公司建设官方网站需要多少钱推广途径有哪些
  • wordpress图片太多aso优化排名推广
  • 做网站首页图片营销伎巧第一季
  • 网页编辑器插件东莞网站推广及优化
  • 哈尔滨哪里做网站站长工具关键词挖掘
  • 坡头手机网站建设一站式软文发布推广平台
  • 做pc端网站代理商花生壳免费域名注册
  • 纯静态网站制作2345网址导航浏览器下载
  • 关键词优化除了做网站还有什么方法百度网址安全中心
  • 网站清除数据库网址导航怎样推广
  • 网站建设吸引客户的网站seo最新优化方法
  • 潜江做网站怎样免费建立自己的网站
  • 山西网络科技有限公司seo快速排名软件方案