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

C# Controls.ListView类代码示例

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

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



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

示例1: switch

 void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) {
     switch (connectionId)
     {
     case 1:
     this.ProgramsMenuAppsView = ((System.Windows.Controls.ListView)(target));
     return;
     case 2:
     this.InstalledAppsView = ((System.Windows.Controls.ListView)(target));
     return;
     case 3:
     
     #line 106 "..\..\AppGrabberUI.xaml"
     ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.SkipWizard);
     
     #line default
     #line hidden
     return;
     case 4:
     
     #line 112 "..\..\AppGrabberUI.xaml"
     ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.Button_Click);
     
     #line default
     #line hidden
     return;
     }
     this._contentLoaded = true;
 }
开发者ID:JustOxlamon,项目名称:cairoshell,代码行数:28,代码来源:AppGrabberUI.g.cs


示例2: FocusListView

 public static void FocusListView(ListView view)
 {
     if (!view.IsVisible)
         view.IsVisibleChanged += view_IsVisibleChanged;
     else
         FocusListViewInternal(view);
 }
开发者ID:4058665,项目名称:dnSpy,代码行数:7,代码来源:DebugUtils.cs


示例3: AddOption

        private void AddOption(ListView listview, string optionName, object obj, string propertyName)
        {
            ConfigClasses.EquipmentConfig config = Manager.ConfigManager.Instance.Config;

            if (config.OptionSettingList == null)
                config.OptionSettingList = new FALibrary.Utility.SerializableDictionary<string, ConfigClasses.OptionSetting>();

            if (config.OptionSettingList.ContainsKey(propertyName) == false)
                config.OptionSettingList.Add(propertyName, new ConfigClasses.OptionSetting());

            ConfigClasses.OptionSetting optionSetting = config.OptionSettingList[propertyName];
            optionSetting.Source = obj;
            optionSetting.Descriptoin = optionName;

            CheckBox checkBoxUse = CreateCheckBox(obj, propertyName);
            CheckBox checkBoxEnabledValueChecking = CreateCheckBox(optionSetting, "EnabledValueChecking");
            CheckBox checkBoxCorrectValue = CreateCheckBox(optionSetting, "CorrectValue");

            listview.Items.Add(new
            {
                CheckBoxUse = checkBoxUse,
                Name = optionName,
                ValueChecking = checkBoxEnabledValueChecking,
                CorrectValue = checkBoxCorrectValue,
                Self = this
            });

            OptionManager.Instance.SetOptionList();
        }
开发者ID:vesteksoftware,项目名称:Onyang_3L_CSharp_VT5080,代码行数:29,代码来源:PageOption.xaml.cs


示例4: ImagePage

 public ImagePage(ListView parentList)
 {
     _parentList = parentList;
     InitializeComponent();
     UpdateImageFromParent();
     _parentList.SelectionChanged += _parentList_SelectionChanged;
 }
开发者ID:Ronacs,项目名称:WinDevCamp,代码行数:7,代码来源:ImagePage.xaml.cs


示例5: OnApplyTemplate

        public override void OnApplyTemplate()
        {
            base.OnApplyTemplate();

            _ItemsView = (ListView)GetTemplateChild("PART_ItemsView");
            _ItemsView.SelectionMode = SelectionMode.Multiple;
        }
开发者ID:Kation,项目名称:ComBoost,代码行数:7,代码来源:EntityMultipleSelector.cs


示例6: checkFile

        //checks if the safe file settings.txt exists.
        //if it exists, viewing content in the listview
        //if not, creating a new one
        public void checkFile(ListView listView)
        {
            try
            {
                //getting the text out of the .txt
                string[] lines = File.ReadAllLines("settings.txt");
                for (int i = 0; i < lines.Length;)
                {
                    //fill the Item with needed values
                    var extractedIcon = System.Drawing.Icon.ExtractAssociatedIcon(lines[i + 1]);

                    var bmSrc = Imaging.CreateBitmapSourceFromHIcon(
                            extractedIcon.Handle,
                            Int32Rect.Empty,
                            System.Windows.Media.Imaging.BitmapSizeOptions.FromEmptyOptions());
                    extractedIcon.Dispose();

                    Item item = new Item(bmSrc, lines[i], lines[i+1]);

                    //adding Item to ListView
                    listView.Items.Add(item);

                    i += 2;
                }
            }
            //if the file does not exist, creating a new one
            catch (FileNotFoundException e)
            {
                File.Create("settings.txt");
            }
        }
开发者ID:Chenmaster1,项目名称:MyGames_Git,代码行数:34,代码来源:ListViewLogic.cs


示例7: switch

 void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) {
     switch (connectionId)
     {
     case 1:
     
     #line 13 "..\..\MainWindow.xaml"
     ((System.Windows.Controls.TreeView)(target)).SelectedItemChanged += new System.Windows.RoutedPropertyChangedEventHandler<object>(this.SelectedDirectoryChanged);
     
     #line default
     #line hidden
     return;
     case 2:
     this.listViewFiles = ((System.Windows.Controls.ListView)(target));
     
     #line 22 "..\..\MainWindow.xaml"
     this.listViewFiles.ContextMenuOpening += new System.Windows.Controls.ContextMenuEventHandler(this.listViewFiles_ContextMenuOpening);
     
     #line default
     #line hidden
     
     #line 22 "..\..\MainWindow.xaml"
     this.listViewFiles.MouseDown += new System.Windows.Input.MouseButtonEventHandler(this.listViewFiles_MouseDown);
     
     #line default
     #line hidden
     return;
     }
     this._contentLoaded = true;
 }
开发者ID:Hackason,项目名称:FM2012,代码行数:29,代码来源:MainWindow.g.cs


示例8: ImageListView

 public ImageListView(ListView lstImage)
 {
     // TODO: Complete member initialization
       this.lstImage = lstImage;
       this.initImageList();
       spyer.ImageListView = this;
 }
开发者ID:hxshandle,项目名称:PrintCat,代码行数:7,代码来源:ImageListView.cs


示例9: OnInitialized

        protected override void OnInitialized(EventArgs e)
        {
            base.OnInitialized(e);


            _errorList = Content as ListView;
        }
开发者ID:mousetwentytwo,项目名称:test,代码行数:7,代码来源:ErrorListContent.cs


示例10: BuildDockingLayout

        void BuildDockingLayout()
        {
            dockManager.Content = null;

            //TreeView dockable content
            var trv = new TreeView();
            trv.Items.Add(new TreeViewItem() { Header = "Item1" });
            trv.Items.Add(new TreeViewItem() { Header = "Item2" });
            trv.Items.Add(new TreeViewItem() { Header = "Item3" });
            trv.Items.Add(new TreeViewItem() { Header = "Item4" });
            ((TreeViewItem)trv.Items[0]).Items.Add(new TreeViewItem() { Header = "SubItem1" });
            ((TreeViewItem)trv.Items[0]).Items.Add(new TreeViewItem() { Header = "SubItem2" });
            ((TreeViewItem)trv.Items[1]).Items.Add(new TreeViewItem() { Header = "SubItem3" });
            ((TreeViewItem)trv.Items[2]).Items.Add(new TreeViewItem() { Header = "SubItem4" });
            var treeviewContent = new DockableContent() { Title = "Explorer", Content = trv };

            treeviewContent.Show(dockManager, AnchorStyle.Bottom);

            //TextBox invo dockable content
            var treeviewInfoContent = new DockableContent() { Title = "Explorer Info", Content = new TextBox() { Text = "Explorer Info Text", IsReadOnly = true } };
            treeviewContent.ContainerPane.Items.Add(treeviewInfoContent);

            //ListView dockable content
            var gridView = new GridView();
            gridView.Columns.Add(new GridViewColumn() { Header = "Date" });
            gridView.Columns.Add(new GridViewColumn() { Header = "Day Of Weeek", DisplayMemberBinding = new Binding("DayOfWeek") });
            gridView.Columns.Add(new GridViewColumn() { Header = "Year", DisplayMemberBinding = new Binding("Year") });
            gridView.Columns.Add(new GridViewColumn() { Header = "Month", DisplayMemberBinding = new Binding("Month") });
            gridView.Columns.Add(new GridViewColumn() { Header = "Second", DisplayMemberBinding = new Binding("Second") });
            var listView = new ListView() { View = gridView };
            listView.Items.Add(DateTime.Now);
            listView.Items.Add(DateTime.Now.AddYears(-1));
            listView.Items.Add(DateTime.Now.AddMonths(15));
            listView.Items.Add(DateTime.Now.AddHours(354));

            var listViewContent = new DockableContent() { Title = "Date & Times", Content = listView };
            listViewContent.ShowAsFloatingWindow(dockManager, true);

            //TextBox dockable content
            var textboxSampleContent = new DockableContent() { Title = "Date & Times Info", Content = new TextBox() { Text = "Date & Times Info Text", IsReadOnly = true } };
            listViewContent.ContainerPane.Items.Add(textboxSampleContent);

            //DataGrid document
            //var dataGrid = new DataGrid();
            //var rnd = new Random();
            //var data = new List<Tuple<double, double, double, double>>();
            //for (int i = 0; i < 100; i++)
            //{
            //    data.Add(Tuple.Create(rnd.NextDouble(), rnd.NextDouble() * 10.0, rnd.NextDouble() * 100.0, rnd.NextDouble() * 1000.0));
            //}

            //dataGrid.ItemsSource = data;

            //var dataGridDocument = new DocumentContent() { Title = "Data", IsLocked = true, Content = dataGrid };
            //dataGridDocument.Show(dockManager);

            ////DataGrid Info Text sample
            //var dataGridInfoContent = new DockableContent() { Title = "Data Info", Content = new TextBox() { Text = "Data Info Text" } };
            //dataGridInfoContent.ShowAsDocument(dockManager);
        }
开发者ID:JeremyDurnell,项目名称:ChromeTabs,代码行数:60,代码来源:MainWindow.xaml.cs


示例11: DeleteListViewSelectedItem

        private void DeleteListViewSelectedItem(ListView lv)
        {
            object obj = lv.SelectedItem;

            if (obj is NwdPortableDeviceFolder)
            {
                MessageBox.Show("folder delete not supported yet");
            }

            if (obj is NwdPortableDeviceFile)
            {
                NwdPortableDeviceFile pdf = (NwdPortableDeviceFile)obj;

                if (MessageBox.Show("Are you sure you want to delete " + pdf.Name,
                                   "Confirm Deletion",
                                   MessageBoxButton.YesNo) == MessageBoxResult.Yes)
                {
                    _currentDevice.DeleteFile(pdf);

                    MessageBox.Show("file deleted");
                }

            }

            if (obj == null)
            {
                MessageBox.Show("null selection");
            }
        }
开发者ID:BBuchholz,项目名称:NineWorldsDeep,代码行数:29,代码来源:MtpMainWindow.xaml.cs


示例12: PerfMarginPanel

        public PerfMarginPanel()
        {
            Logger.SetLogger(AggregateLogger.AddOrReplace(logger, Logger.GetLogger(), l => l is PerfEventActivityLogger));

            // grid
            mainGrid = new Grid();
            mainGrid.ColumnDefinitions.Add(new ColumnDefinition());
            mainGrid.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
            mainGrid.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });

            // set diagnostic list
            this.mainListView = CreateContent(new ActivityLevel[] { model.RootNode }.Concat(model.RootNode.Children), useWrapPanel: true);
            this.mainListView.SelectionChanged += OnPerfItemsListSelectionChanged;
            Grid.SetRow(this.mainListView, 0);

            mainGrid.Children.Add(this.mainListView);

            this.Content = mainGrid;

            this.timer = new DispatcherTimer(TimeSpan.FromMilliseconds(500), DispatcherPriority.Background, UpdateUI, this.Dispatcher);
            StartTimer();

            model.RootNode.IsActiveChanged += (s, e) =>
            {
                if (this.stopTimer)
                {
                    StartTimer();
                }
            };
        }
开发者ID:elemk0vv,项目名称:roslyn-1,代码行数:30,代码来源:PerfMarginPanel.cs


示例13: ImageWindow

 public ImageWindow(ListView view)
 {
     parentView = view;
     InitializeComponent();
     image.Source = (parentView.SelectedItem as Image).Source;
     parentView.SelectionChanged += View_SelectionChanged;
 }
开发者ID:pospanet,项目名称:MSFest2015_Brno,代码行数:7,代码来源:ImageWindow.xaml.cs


示例14: LRM

 public LRM(string domain, ListView view)
 {
     this.domain = domain;
     resources = new Dictionary<string, SNPLink>();
     linkConnections = new Dictionary<string, Topology.Link>();
     this.links = view;
 }
开发者ID:sopel30,项目名称:tsst2,代码行数:7,代码来源:LRM.cs


示例15: checkFile

        public void checkFile(ListView listView)
        {
            try
            {

                string[] lines = File.ReadAllLines("settings.txt");
                for (int i = 0; i < lines.Length;)
                {
                    Item item = new Item();
                    item.game = lines[i];
                    item.path = lines[i + 1];

                    var extractedIcon = System.Drawing.Icon.ExtractAssociatedIcon(item.path);

                    var bmSrc = Imaging.CreateBitmapSourceFromHIcon(
                            extractedIcon.Handle,
                            Int32Rect.Empty,
                            System.Windows.Media.Imaging.BitmapSizeOptions.FromEmptyOptions());
                    extractedIcon.Dispose();

                    item.icon = bmSrc;

                    listView.Items.Add(item);

                    i += 2;
                }
            }
            catch (FileNotFoundException e)
            {
                File.Create("settings.txt");
            }
        }
开发者ID:Chenmaster1,项目名称:MyGames,代码行数:32,代码来源:ListViewLogic.cs


示例16: OnApplyTemplate

        public override void OnApplyTemplate()
        {
            base.OnApplyTemplate();

            view = GetTemplateChild("PART_GridDisplay") as ListView;
            view.ItemsSource = _weeks;
        }
开发者ID:ssickles,项目名称:archive,代码行数:7,代码来源:CalendarControl.cs


示例17: addGameToView

        //adding a game to ListView
        public void addGameToView(ListView listView)
        {
            //open a FileDialog
            OpenFileDialog ofd = new OpenFileDialog();
            ofd.Filter = "exe files (*.exe)|*.exe";

            if (ofd.ShowDialog() == true)
            {

                //creating an Item an fill it with needed values
                var extractedIcon = System.Drawing.Icon.ExtractAssociatedIcon(ofd.FileName);
                var bmSrc = Imaging.CreateBitmapSourceFromHIcon(
                            extractedIcon.Handle,
                            Int32Rect.Empty,
                            System.Windows.Media.Imaging.BitmapSizeOptions.FromEmptyOptions());
                extractedIcon.Dispose();

                Item item = new Item(bmSrc, Path.GetFileNameWithoutExtension(ofd.FileName), ofd.FileName);

                //adding item to ListView
                listView.Items.Add(item);

                //saving Item into settings.txt
                using (StreamWriter file =
                    new StreamWriter("settings.txt", true))
                {
                    file.WriteLine(item.game);
                    file.WriteLine(item.path);
                }
            }

            //setting ListView Width to needed Width
            double remainingSpace = listView.ActualWidth;
            (listView.View as GridView).Columns[1].Width = Math.Ceiling(remainingSpace);
        }
开发者ID:Chenmaster1,项目名称:MyGames_Git,代码行数:36,代码来源:ListViewLogic.cs


示例18: MainWindow

 public MainWindow()
 {
     InitializeComponent();
     AddNewPanel();
     AddNewPanel();
     ActiveListView = panels[0].PanelsListView;
 }
开发者ID:pseudowolfvn,项目名称:FileManager,代码行数:7,代码来源:MainWindow.xaml.cs


示例19: ListSystemParameters

        public ListSystemParameters()
        {
            Title = "List System Parameters";

            ListView lstvue = new ListView();
            Content = lstvue;

            GridView grdvue = new GridView();
            lstvue.View = grdvue;

            GridViewColumn col = new GridViewColumn();
            col.Header = "Property Name";
            col.Width = 200;
            col.DisplayMemberBinding = new Binding("Name");
            grdvue.Columns.Add(col);

            col = new GridViewColumn();
            col.Header = "Value";
            col.Width = 200;
            col.DisplayMemberBinding = new Binding("Value");
            grdvue.Columns.Add(col);

            PropertyInfo[] props = typeof(SystemParameters).GetProperties();
            foreach (PropertyInfo prop in props)
            {
                if (prop.PropertyType != typeof(ResourceKey))
                {
                    SystemParam sysparam = new SystemParam();
                    sysparam.Name = prop.Name;
                    sysparam.Value = prop.GetValue(null, null);
                    lstvue.Items.Add(sysparam);
                }
            }
        }
开发者ID:JianchengZh,项目名称:kasicass,代码行数:34,代码来源:ListSystemParameters.cs


示例20: AddNewPanel

 public Panel AddNewPanel()
 {
     ListView newLV = new ListView();
     ComboBox newCB = new ComboBox();
     panels.Add(new Panel(newCB, newLV));
     newLV.Style = Resources["PanelListView"] as Style;
     newLV.ItemContainerStyle = Resources["PanelListViewItem"] as Style; ;
     GridView columns = new GridView();
     columns.Columns.Add(AddGridViewColumn( "Name", "Name"));
     columns.Columns.Add(AddGridViewColumn( "Type", "Extension"));
     columns.Columns.Add(AddGridViewColumn( "Size", "Length"));
     columns.Columns.Add(AddGridViewColumn( "Date of creation", "CreationTime"));
     newLV.View = columns;
     newLV.Loaded += PanelInitialized;
     newCB.Style = Resources["DrivesComboBox"] as Style;
     ColumnDefinition newColumn = new ColumnDefinition();
     newColumn.Width = new GridLength(1, GridUnitType.Star);
     PanelsGrid.ColumnDefinitions.Add(newColumn);
     newLV.SetValue(Grid.RowProperty, 1);
     newLV.SetValue(Grid.ColumnProperty, numOfPanels);
     newCB.SetValue(Grid.RowProperty, 0);
     newCB.SetValue(Grid.ColumnProperty, numOfPanels);
     PanelsGrid.Children.Add(newLV);
     PanelsGrid.Children.Add(newCB);
     AddDrivesInComboBox(newCB);
     newCB.SelectionChanged += DiskChanged;
     return panels[numOfPanels++];
 }
开发者ID:pseudowolfvn,项目名称:FileManager,代码行数:28,代码来源:MainWindow.xaml.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# Controls.ListViewItem类代码示例发布时间:2022-05-26
下一篇:
C# Controls.ListBoxItem类代码示例发布时间: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