Inheritance: ListViewItem
示例#1
0
        // 将项目移到插入标记所在的位置
        private void listView_DragDrop(object sender, DragEventArgs e)
        {
            // 返回插入标记的索引值
            int index = listView.InsertionMark.Index;

            // 如果插入标记不可见,则退出.
            if (index == -1)
            {
                return;
            }
            // 如果插入标记在项目的右面,使目标索引值加一
            if (listView.InsertionMark.AppearsAfterItem)
            {
                index++;
            }

            // 返回拖拽项
            MyListViewItem item = (MyListViewItem)e.Data.GetData(typeof(MyListViewItem));
            //在目标索引位置插入一个拖拽项目的副本
            MyListViewItem ni = new MyListViewItem(item.media, item.ImageIndex);

            listView.Items.Insert(index, ni);
            // 移除拖拽项目的原文件
            listView.Items.Remove(item);
        }
    protected override DependencyObject GetContainerForItemOverride()
    {
        var item = new MyListViewItem();

        item.RightTapped += OnItemRightTapped;
        return(item);
    }
示例#3
0
        public IList <Media> getMediaList()
        {
            IList <Media> medias = new List <Media>();

            foreach (ListViewItem viewItem in this.listView.Items)
            {
                MyListViewItem i = (MyListViewItem)viewItem;
                medias.Add(i.media);
                //medias.Insert(i.ImageIndex, i.media);
            }
            this.mediaList = medias;
            return(this.mediaList);
        }
示例#4
0
 private void LoadObjectIds()
 {
     foreach (RegInfo ri in Settings.Sate.Register)
     {
         try
         {
             MyListViewItem ml = new MyListViewItem(ri.typeId, ri.handlerIdSer.HandlerId(), ri.pending, ri.injection);
             reglistView.Items.Add(ml);
         }
         catch (Safir.Dob.Typesystem.IllegalValueException)
         {
         }
     }
     foreach (SubInfo si in Settings.Sate.Subscribe)
     {
         try
         {
             MyListViewItem ml = new MyListViewItem(si.typeId, si.entityIdSer != null ? si.entityIdSer.EntityId() : null, si.channelIdSer.ChannelId(), si.upd, si.restartSubscription);
             sublistView.Items.Add(ml);
         }
         catch (Safir.Dob.Typesystem.IllegalValueException)
         {
         }
     }
     foreach (SubRegInfo sri in Settings.Sate.SubscribeReg)
     {
         try
         {
             MyListViewItem ml = new MyListViewItem(sri.typeId, sri.handlerIdSer.HandlerId(), sri.includeSubClasses, sri.restartSubscription, false);
             subRegListView.Items.Add(ml);
         }
         catch (Safir.Dob.Typesystem.IllegalValueException)
         {
         }
     }
 }
示例#5
0
        private void RefreshList()
        {
            MyListViewItem item = new MyListViewItem();

            listView1.BeginUpdate();
            listView1.Items.Clear();

            item.Text = "..";
            item.ImageIndex = iconListManager.GetIcon(IconListManager.IconTypes.Up);
            item.IsDir = true;
            listView1.Items.Add(item);

            try
            {

                fileInfos = ftpConnection1.GetFileInfos();
            }
            catch (Exception e)
            {
                MessageBox.Show("FTP Error: " + e.Message);
                return;
            }

            foreach (EnterpriseDT.Net.Ftp.FTPFile file in fileInfos)
            {
                if(file.Name.StartsWith("."))
                    continue;

                item = new MyListViewItem();
                item.Text = file.Name;

                if (file.Dir == true)
                {
                    item.ImageIndex = iconListManager.GetIcon(IconListManager.IconTypes.FolderClosed);
                    item.SubItems.Add("0");
                    item.IsDir = true;
                }
                else
                {
                    item.ImageIndex = iconListManager.GetIcon(file.Name);
                    item.SubItems.Add(file.Size.ToString());
                    item.IsDir = false;
                }
                item.SubItems.Add(file.LastModified.ToString());
                listView1.Items.Add(item);
            }
            listView1.Sort();
            listView1.EndUpdate();
        }
示例#6
0
        private ListViewItem parseListViewItem(Media media, int imageIndex)
        {
            MyListViewItem item = new MyListViewItem(media, imageIndex);

            return(item);
        }