• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Controls.ListViewItem类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中System.Windows.Controls.ListViewItem的典型用法代码示例。如果您正苦于以下问题:C# ListViewItem类的具体用法?C# ListViewItem怎么用?C# ListViewItem使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ListViewItem类属于System.Windows.Controls命名空间,在下文中一共展示了ListViewItem类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: UpdateListView

 public void UpdateListView()
 {                        
     Process[] Processes = Process.GetProcesses();
   //  Array.Sort(Processes, new CompareProcessStartTime());
     var sorted = from p in Processes orderby StartTimeNoException(p) descending, p.Id select p;            
     foreach (Process p in sorted)          
     {
         
         ProcessModule pm;
         string path;
         try { pm = p.MainModule; }
         catch (Exception) { continue; }
         try { path = pm.FileName; }
         catch (Exception) { continue; }
         if (p.ProcessName == "svchost") continue;
         ListViewItem lvi = new ListViewItem() {Tag=p };
         StackPanel sp = new StackPanel() { Width = 64, Height = 64 };
         Image i = new Image() { Source = GetAssociatedIcon(path), Width = 32, Height = 32 };
         TextBlock tb = new TextBlock()
         {
             TextWrapping = System.Windows.TextWrapping.Wrap,
             MaxWidth = sp.Width,
             Text = p.ProcessName,
             HorizontalAlignment = System.Windows.HorizontalAlignment.Center,
             VerticalAlignment = System.Windows.VerticalAlignment.Top,
             TextAlignment = TextAlignment.Center
         };
         sp.Children.Add(i);
         sp.Children.Add(tb);
         lvi.Content = sp;
         lv.Items.Add(lvi);           
     }
    
 }
开发者ID:NightmareX1337,项目名称:lfs,代码行数:34,代码来源:wSelectProcess.xaml.cs


示例2: bindingArry

        private void bindingArry(string[][] source)
        {
            Brush blackBrush = new SolidColorBrush(Colors.Black);
              Brush grayBrush = new SolidColorBrush(Colors.LightBlue);
              Thickness borderThickness = new Thickness(1);

              foreach (string[] line in source)
              {
            ListViewItem lvi = new ListViewItem();
            StackPanel sp = new StackPanel();
            sp.Orientation = Orientation.Horizontal;

            foreach (string item in line)
            {
              Label itemLabel = new Label();
              itemLabel.Background = grayBrush;
              itemLabel.BorderBrush = blackBrush;
              itemLabel.BorderThickness = borderThickness;
              itemLabel.Content = item;
              sp.Children.Add(itemLabel);
            }
            lvi.Content = sp;
            lvTable.Items.Add(lvi);
              }
        }
开发者ID:lostyear,项目名称:CsvFilter,代码行数:25,代码来源:MainWindow.xaml.cs


示例3: SubmitEditBtn_Click

        private void SubmitEditBtn_Click(object sender, RoutedEventArgs e)
        {
            Spell currSpell = shared.currentSpell != null ? shared.currentSpell : new Spell();
            if (SpellNameEditTxtBx.Text != currSpell.SpellName && currSpell == shared.currentSpell)
            {
                currSpell.SpellName = SpellNameEditTxtBx.Text;
                shared.spellListView.Items.Clear();

                foreach (Spell spell in shared.character.spells) {
                    ListViewItem newItem = new ListViewItem();
                    newItem.Content = spell.SpellName;
                    shared.spellListView.Items.Add(newItem);
                }
            }
            else {
                currSpell.SpellName = SpellNameEditTxtBx.Text;
            }
            
            currSpell.Rank = Convert.ToInt32(RankEditTxtBx.Text);
            currSpell.Description = DescriptionEditTxtBx.Text;
            currSpell.Requirement = ReqEditTxtBx.Text;
            currSpell.Area = AreaEditTxtBx.Text;
            currSpell.Duration = DurationEditTxtBx.Text;

            if (currSpell != shared.currentSpell)
            {
                currSpell.Casts = 0;
                shared.character.spells.Add(currSpell);
                ListViewItem newItem = new ListViewItem();
                newItem.Content = currSpell.SpellName;
                shared.spellListView.Items.Add(newItem);
            }
            shared.currentSpell = currSpell;
            this.Close();
        }
开发者ID:justbark,项目名称:RpgAssist,代码行数:35,代码来源:SpellForm.xaml.cs


示例4: AddDependency

 void AddDependency(object pSender, RoutedEventArgs pEvents)
 {
   var lDialog = new Microsoft.Win32.OpenFileDialog()
   {
     Title = "Choose dependency Assembly",
     CheckFileExists = true,
     Filter = "Assemblies|*.dll;*.exe;*.winmd|All Files|*.*",
     Multiselect = true
   };
   if (lDialog.ShowDialog() == true)
   {
     foreach (string lName in lDialog.FileNames)
     {
       // Check if the dependency is already on the list.
       var lSameLib = (
           from ListViewItem lItem in DependencyList.Items
           where lItem.Content.Equals(lName)
           select lItem);
       if (lSameLib.Count() == 0)
       {
         ListViewItem lEntry = new ListViewItem();
         lEntry.Content = lName;
         DependencyList.Items.Add(lEntry);
       }
     }
   }
 }
开发者ID:VelocityDB,项目名称:VelocityDB,代码行数:27,代码来源:ConnectionDialog.xaml.cs


示例5: AddList

 private void AddList(Data.BOKhachHang item)
 {
     ListViewItem li = new ListViewItem();
     li.Content = item;
     li.Tag = item;
     lvData.Items.Add(li);
 }
开发者ID:MisterTobi,项目名称:restaurant-cafe,代码行数:7,代码来源:WindowTimKhachHang.xaml.cs


示例6: CreateList

        /// <summary>
        /// Kreiranje listview-a na temelju liste objetata u parametru.
        /// </summary>
        /// <param name="classesList"></param>
        public void CreateList(List<object> classesList)
        {
            foreach (String[] classArrayString in classesList) {
                Grid grid = new Grid();
                grid.ShowGridLines = true;
                grid.RowDefinitions.Add(new RowDefinition());
                grid.Margin = new Thickness(30, 10, 30, 0);

                for (int i=0; i < classArrayString.Length; i++) {
                    ColumnDefinition columnDef = new ColumnDefinition();
                    columnDef.Width = new GridLength(150);
                    grid.ColumnDefinitions.Add(columnDef);

                    Label label = new Label();
                    label.Content = classArrayString[i];
                    Grid.SetColumn(label, i);
                    Grid.SetRow(label, 0);

                    grid.Children.Add(label);
                }

                ListViewItem listItem = new ListViewItem();
                listItem.Content = grid;
                currentListView.Items.Add(listItem);
            }
        }
开发者ID:idurlen92,项目名称:E_Grader,代码行数:30,代码来源:ClassesView.xaml.cs


示例7: Bookmark

        public Bookmark(KinectBrowser.D3D.Browser.D3DBrowser browser)
        {
            this.InitializeComponent();

            currentBrowser = browser;
            xmlPath = Directory.GetParent(Environment.CurrentDirectory)+"\\KinectBrowser\\bookmark.xml";

            xmlDoc = new XmlDocument();
            xmlDoc.Load(xmlPath);

            XmlNodeList bookmarkList = xmlDoc.GetElementsByTagName("Bookmark");

            foreach (XmlNode node in bookmarkList)
            {
                XmlElement bookmarkElement = (XmlElement) node;

                string title = bookmarkElement.GetElementsByTagName("Title")[0].InnerText;
                string url = bookmarkElement.GetElementsByTagName("Url")[0].InnerText;

                ListViewItem item = new ListViewItem();
                item.Content = title;
                item.ToolTip = url;
                item.Selected += new RoutedEventHandler(Select_bookmark);
                //item.MouseDoubleClick += new MouseButtonEventHandler(Bookmark_DoubleClick);
                listView1.Items.Add(item);
            }
        }
开发者ID:KarimLUCCIN,项目名称:JNUI,代码行数:27,代码来源:Bookmark.xaml.cs


示例8: Bookmark

        public Bookmark(WebBrowser webBrowser)
        {
            this.InitializeComponent();

            wb = webBrowser;
            xmlPath = Directory.GetParent(Environment.CurrentDirectory).Parent.FullName+"\\bookmark.xml";

            xmlDoc = new XmlDocument();
            xmlDoc.Load(xmlPath);

            XmlNodeList bookmarkList = xmlDoc.GetElementsByTagName("Bookmark");

            foreach (XmlNode node in bookmarkList)
            {
                XmlElement bookmarkElement = (XmlElement) node;

                string title = bookmarkElement.GetElementsByTagName("Title")[0].InnerText;
                string url = bookmarkElement.GetElementsByTagName("Url")[0].InnerText;

                ListViewItem item = new ListViewItem();
                item.Content = title;
                item.ToolTip = url;
                item.Selected += new RoutedEventHandler(Select_bookmark);
                listView1.Items.Add(item);
            }
        }
开发者ID:KarimLUCCIN,项目名称:JNUI,代码行数:26,代码来源:Bookmark.xaml.cs


示例9: DragList_DragOver

 private void DragList_DragOver(object sender, DragEventArgs e)
 {
     _overTarget = ((DependencyObject)e.OriginalSource).FindAnchestor<ListViewItem>();
     if (_overTarget == null) return;
     if (_draggedItem == _overTarget) return;
     (_overTarget.Content as AssetViewModel).DragOverTarget = true;
 }
开发者ID:TiagoJSM,项目名称:Storytime,代码行数:7,代码来源:RenderableAssetOrderControl.xaml.cs


示例10: RefreshPlaylist

        public void RefreshPlaylist(Playlist playlist)
        {
            Dispatcher.BeginInvoke(DispatcherPriority.Render, new Action(() =>
            {
                _playlist = playlist;
                listViewPlaylist.Items.Clear();
                listViewPlaylistAlbumArt.Items.Clear();
                string currentAlbum = string.Empty;
                int songCount = 0;
                foreach (var item in _playlist.Items)
                {
                    // Add only one row per album (to do: expose row height in viewmodel)
                    songCount++;                                            
                    string album = string.Format("{0}_{1}", item.AudioFile.ArtistName, item.AudioFile.AlbumTitle).ToUpper();
                    if (string.IsNullOrEmpty(currentAlbum))
                    {
                        currentAlbum = album;
                    }
                    else if (album != currentAlbum)
                    {
                        //Console.WriteLine("PlaylistWindow - RefreshPlaylists - Album: {0} SongCount: {1}", album, songCount);
                        var listViewItem = new ListViewItem();
                        listViewItem.Background = new LinearGradientBrush(Colors.HotPink, Colors.Yellow, 90);
                        listViewItem.Height = (songCount - 1) * 24;
                        listViewItem.Content = string.Format("{0}/{1}", (songCount - 1), currentAlbum);
                        listViewPlaylistAlbumArt.Items.Add(listViewItem);
                        currentAlbum = album;
                        songCount = 1;
                    }

                    listViewPlaylist.Items.Add(item);
                }
            }));
        }
开发者ID:pascalfr,项目名称:MPfm,代码行数:34,代码来源:PlaylistWindow.xaml.cs


示例11: PrepareItem

        protected override void PrepareItem(ListViewItem item)
        {
            if (_autoWidthColumns == null)
            {
                _autoWidthColumns = new HashSet<int>();

                foreach (var column in Columns)
                {
                    if(double.IsNaN(column.Width))
                        _autoWidthColumns.Add(column.GetHashCode());
                }                
            }

            foreach (var column in Columns)
            {
                if (_autoWidthColumns.Contains(column.GetHashCode()))
                {
                    if (double.IsNaN(column.Width))
                        column.Width = column.ActualWidth;

                    column.Width = double.NaN;                    
                }          
            }

            base.PrepareItem(item);
        }        
开发者ID:artious,项目名称:unifiedTrinity-2.x.x,代码行数:26,代码来源:AutoSizedGridView.cs


示例12: CaseViewer

        public CaseViewer()
        {
            InitializeComponent();
            MyData md = new MyData();
            md.CaseName = "dddd";

            string[] row = { "1", "case1", "case1", "case1", "case1" };
            ListViewItem ldv = new ListViewItem();

            XmlDocument doc = new XmlDocument();
            doc.PreserveWhitespace = false;
            doc.Load("record.xml");
            XmlNode root = doc.DocumentElement;
            XmlNodeList nodes = root.SelectNodes("Child");
            foreach (XmlNode node in nodes)
            {
                for (int i = 0; i < 5; i++)
                {
                    Console.WriteLine(node.ChildNodes[i].InnerText);
                }

                MyData item = new MyData
                {
                    CaseNumber = node.ChildNodes[0].InnerText.ToString(),
                    CaseName = node.ChildNodes[1].InnerText.ToString(),
                    CaseNotes = node.ChildNodes[2].InnerText.ToString(),
                    LastUpdatedBy = node.ChildNodes[3].InnerText.ToString(),
                    LastUpdateDate = node.ChildNodes[4].InnerText.ToString()
                };
                lstvu1.Items.Add(item);
            }
        }
开发者ID:suyueyong,项目名称:CaseManager,代码行数:32,代码来源:CaseViewer.xaml.cs


示例13: AddList

 private void AddList(Data.BOMenuKichThuocMon item)
 {
     ListViewItem li = new ListViewItem();
     li.Content = item;
     li.Tag = item;
     lvData.Items.Add(li);
 }
开发者ID:MisterTobi,项目名称:restaurant-cafe,代码行数:7,代码来源:UCDanhSachBanList.xaml.cs


示例14: SPDefinitionWindow

 public SPDefinitionWindow()
 {
     InitializeComponent();
     def = Program.Configs[Program.SelectedConfig].GetSMDef();
     if (def == null)
     {
         MessageBox.Show("The config was not able to parse a sourcepawn definiton.", "Stop", MessageBoxButton.OK, MessageBoxImage.Warning);
         this.Close();
         return;
     }
     List<SPDefEntry> defList = new List<SPDefEntry>();
     for (int i = 0; i < def.Functions.Length; ++i) { defList.Add((SPDefEntry)def.Functions[i]); }
     for (int i = 0; i < def.Constants.Length; ++i) { defList.Add(new SPDefEntry() { Name = def.Constants[i], Entry = "Constant" }); }
     for (int i = 0; i < def.Types.Length; ++i) { defList.Add(new SPDefEntry() { Name = def.Types[i], Entry = "Type" }); }
     for (int i = 0; i < def.MethodNames.Length; ++i) { defList.Add(new SPDefEntry() { Name = def.MethodNames[i], Entry = "Method" }); }
     for (int i = 0; i < def.Properties.Length; ++i) { defList.Add(new SPDefEntry() { Name = def.Properties[i], Entry = "Property" }); }
     defList.Sort((a, b) => { return string.Compare(a.Name, b.Name); });
     defArray = defList.ToArray();
     int defArrayLength = defArray.Length;
     items = new ListViewItem[defArrayLength];
     for (int i = 0; i < defArrayLength; ++i)
     {
         items[i] = new ListViewItem() { Content = defArray[i].Name, Tag = defArray[i].Entry };
         SPBox.Items.Add(items[i]);
     }
     searchTimer.Elapsed += searchTimer_Elapsed;
 }
开发者ID:not1ce111,项目名称:Spedit,代码行数:27,代码来源:SPDefinitionWindow.xaml.cs


示例15: LoadData

        public void LoadData(List<Group> groups)
        {
            listView.Items.Clear();

            foreach (TreeViewItem item in treeView.Items)
            {
                item.UnregisterName(item.Header.ToString());
            }
            treeView.Items.Clear();

            foreach (Group group in groups)
            {
                TreeViewItem treeViewItem = new TreeViewItem() { Header = group.Name, Tag = group };
                treeView.Items.Add(treeViewItem);
                treeViewItem.RegisterName(group.Name, treeViewItem);

                var persons = group.Persons;

                foreach (Person person in persons)
                {
                    ListViewItem listViewItem = new ListViewItem() { Content = person, Tag = person };
                    listView.Items.Add(listViewItem);

                    TreeViewItem i = treeView.FindName(group.Name) as TreeViewItem;
                    TreeViewItem treeViewSubItem = new TreeViewItem() { Header = person.Name, Tag = person };
                    i.Items.Add(treeViewSubItem);
                }

                treeViewItem.IsExpanded = true;
            }
        }
开发者ID:ChaoMai,项目名称:learning,代码行数:31,代码来源:MainWindow.xaml.cs


示例16: ListViewTest

 public void ListViewTest() {
     var containter = new ListViewItem() { DataContext = itemViewModel1 };
     containter.Content = originalSource;
     var itemsControl = new ListView();
     itemsControl.Items.Add(containter);
     var result = converter.TestConvert(itemsControl, originalSource);
     Assert.AreEqual(itemViewModel1, result);
 }
开发者ID:LINDAIS,项目名称:DevExpress.Mvvm.Free,代码行数:8,代码来源:ItemsControlMouseEventArgsConverterTests.cs


示例17: addUser

        public void addUser(string nick)
        {
            ListViewItem item = new ListViewItem();
            item.Height = 30;
            item.Content = nick;

            ListViewUsers.Items.Add(item);
        }
开发者ID:joselitofilho,项目名称:thewar,代码行数:8,代码来源:ListUsersControl.xaml.cs


示例18: FocusItem

		internal void FocusItem(ListViewItem item)
		{
			if (item != null) {
				focusedItem = item;
				if (!item.IsFocused)
					item.Focus ();
			}
		}
开发者ID:m13253,项目名称:xwt,代码行数:8,代码来源:ExListView.cs


示例19: LoadIcon

        /* Plugin laden und ein Bild zur Toolbox hinzufügen */
        private void LoadIcon(int classid)
        {
            ListViewItem item = new ListViewItem();
            item.ToolTip = icons.getTooltip(classid);
            item.MaxWidth = 75;
            item.Content = icons.getImage(classid);

            this.Items.Add(item);
        }
开发者ID:TLandmann,项目名称:Bachelor-HSRM-Medieninformatik,代码行数:10,代码来源:Toolbox.cs


示例20: GetMappingName

 /// <summary>
 /// Gets the name of the mapping.
 /// </summary>
 /// <param name="listViewItem">The list view item.</param>
 /// <returns></returns>
 private static string GetMappingName(ListViewItem listViewItem)
 {
     string mapping = String.Empty;
     if (listViewItem.DataContext is KeyValuePair<string, IOItem>)
     {
         var item = (KeyValuePair<string, IOItem>)listViewItem.DataContext;
         mapping = item.Value.MappedTo;
     }
     return mapping;
 }
开发者ID:jira-sarec,项目名称:ICSE-2012-TraceLab,代码行数:15,代码来源:BaseComponentNodeInfoControl.cs



注:本文中的System.Windows.Controls.ListViewItem类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Controls.MediaElement类代码示例发布时间:2022-05-26
下一篇:
C# Controls.ListView类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap