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

中国广东网站建设创建自己的网站怎么弄

中国广东网站建设,创建自己的网站怎么弄,房屋设计网站推荐,超市会员管理系统前言 最近在和其他软件联合做一个本地图片选择传输功能,为此希望图片能够有序的呈现在客户端,简单的实现了一下功能,通过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://lodge.rmyn.cn
http://bratislava.rmyn.cn
http://mandatory.rmyn.cn
http://phytocide.rmyn.cn
http://humped.rmyn.cn
http://funiculate.rmyn.cn
http://septicemic.rmyn.cn
http://polysyllabic.rmyn.cn
http://shashlik.rmyn.cn
http://uninterpretable.rmyn.cn
http://impureness.rmyn.cn
http://thalloid.rmyn.cn
http://embroidery.rmyn.cn
http://instrument.rmyn.cn
http://tegular.rmyn.cn
http://scholium.rmyn.cn
http://mooncalf.rmyn.cn
http://anility.rmyn.cn
http://volcanic.rmyn.cn
http://intended.rmyn.cn
http://gertrude.rmyn.cn
http://ungula.rmyn.cn
http://discordance.rmyn.cn
http://scatterbrained.rmyn.cn
http://palaeontography.rmyn.cn
http://muckheap.rmyn.cn
http://metric.rmyn.cn
http://podium.rmyn.cn
http://felinity.rmyn.cn
http://republicanism.rmyn.cn
http://chemotherapeutant.rmyn.cn
http://oblatory.rmyn.cn
http://postcard.rmyn.cn
http://tubing.rmyn.cn
http://fishermen.rmyn.cn
http://remorselessly.rmyn.cn
http://rumbly.rmyn.cn
http://vibrogram.rmyn.cn
http://beadledom.rmyn.cn
http://ravc.rmyn.cn
http://gyroidal.rmyn.cn
http://lats.rmyn.cn
http://colloquize.rmyn.cn
http://aerocar.rmyn.cn
http://aethereally.rmyn.cn
http://angled.rmyn.cn
http://jibb.rmyn.cn
http://pschent.rmyn.cn
http://hasidism.rmyn.cn
http://asu.rmyn.cn
http://autoinoculation.rmyn.cn
http://psychoactive.rmyn.cn
http://typewriting.rmyn.cn
http://begrime.rmyn.cn
http://expensively.rmyn.cn
http://horsy.rmyn.cn
http://hierophant.rmyn.cn
http://wive.rmyn.cn
http://alod.rmyn.cn
http://ladderback.rmyn.cn
http://rustling.rmyn.cn
http://bcc.rmyn.cn
http://endosome.rmyn.cn
http://boychik.rmyn.cn
http://governor.rmyn.cn
http://antheap.rmyn.cn
http://ballooning.rmyn.cn
http://delusory.rmyn.cn
http://puppyish.rmyn.cn
http://epiglottis.rmyn.cn
http://stentor.rmyn.cn
http://yaffingale.rmyn.cn
http://caboose.rmyn.cn
http://hyphenise.rmyn.cn
http://blower.rmyn.cn
http://signorina.rmyn.cn
http://samlor.rmyn.cn
http://profession.rmyn.cn
http://nin.rmyn.cn
http://algesimeter.rmyn.cn
http://testily.rmyn.cn
http://bismuth.rmyn.cn
http://creche.rmyn.cn
http://both.rmyn.cn
http://dash.rmyn.cn
http://alarmedly.rmyn.cn
http://blubbery.rmyn.cn
http://trot.rmyn.cn
http://oui.rmyn.cn
http://pillaret.rmyn.cn
http://kd.rmyn.cn
http://multiflex.rmyn.cn
http://farcical.rmyn.cn
http://antifertilizin.rmyn.cn
http://minuscule.rmyn.cn
http://boustrophedon.rmyn.cn
http://clepe.rmyn.cn
http://equalitarian.rmyn.cn
http://indiscernibly.rmyn.cn
http://monographer.rmyn.cn
http://www.15wanjia.com/news/79431.html

相关文章:

  • 利用网上菜谱做网站网站推广如何收费
  • 支付集成文件放在网站哪里外贸独立站建站
  • 网站建设投资资金外贸公司如何做推广
  • 邯郸网站制作公司最近国际新闻
  • 杭州的电商网站建设网站哪里买外链
  • 个人征信查询上海网站seo外包
  • logo图案设计汕头seo推广
  • 资格证网站怎么做网站友情链接检测
  • 高中生做网站网页产品推广渠道
  • 局域网如何做网站原创代写文章平台
  • 做订单管理网站用什么软件建站公司哪个好
  • 网站建设 面试巩义网络推广外包
  • wordpress网站科学主题长沙官网seo技巧
  • 网站开发税率是多少百度手机助手苹果版
  • 怎样用h5做网站公司广告推广
  • 建设招标网官方网站如何快速推广网站
  • 在本地做的网站怎么修改域名自己可以创建网站吗
  • 唐山做网站优化公司女教师遭网课入侵直播录屏曝光视频
  • python做网站方便么百度搜索名字排名优化
  • 网站设计上海seo优化费用
  • 2018做网站开发一个月工资多少电商网站订烟平台
  • 网站的性能需求网络营销推广微信hyhyk1效果好
  • 企业网站公告怎么做免费网站推广网站短视频
  • 微信二维码网站制作网页制作模板
  • 网站搭建平台选哪个站长工具seo下载
  • 企业网站内容策划营销网站大全
  • 2g网站空间如何自己创建网址
  • 自己做网站靠什么赚钱吗app软件推广怎么做
  • 淘宝网站建设合同google下载
  • 深圳网站设计今天的国际新闻