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

C# Controls.ListViewItem类代码示例

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

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



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

示例1: AddEntry

 public void AddEntry(Transaction ta)
 {
     ListViewItem entry = new ListViewItem();
     entry.Content = ta.TypeName;
     this.ItemList.Items.Add(entry);
     this.taBinding.Add(ta.TypeName, ta);
 }
开发者ID:XF9,项目名称:EVE-Sales,代码行数:7,代码来源:TransactionListItemList.xaml.cs


示例2: OnNavigatedTo

        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            if (App.CardList.Count > 0 && CardListView.Items.Count == 0) // cards were loaded from local storage on load and need to be added to the ListView
            {
                foreach (Card item in App.CardList)
                {
                    CardListView.Items.Add(item);
                }
            }            
            else if (App.CardList.Count == 0 && CardListView.Items.Count == 0)  // there are no cards saved yet
            {
                ListViewItem lvi = new ListViewItem();
                lvi.FontSize = 20;
                lvi.Content = "No Cards Saved Yet";
                CardListView.Items.Add(lvi);
            }
            // a new card has just been scanned or entered manually, update the ListView
            else if ((((ListViewItem)CardListView.Items[0]).Content.ToString() == "No Cards Saved Yet" && App.CardList.Count == CardListView.Items.Count) || App.CardList.Count > CardListView.Items.Count)
            {
                CardListView.Items.Clear();
                foreach (Card item in App.CardList)
                {
                    CardListView.Items.Add(item);
                }
            }

            // disallow navigating backwards from MainPage to previous paths...all roads lead to/from MainPage
            Frame rootFrame = Window.Current.Content as Frame;
            rootFrame.BackStack.Clear();
        }
开发者ID:lorenzofar,项目名称:Rewards-Wallet,代码行数:30,代码来源:MainPage.xaml.cs


示例3: SetSelectedItem

        /// <summary>
        /// Mark the <paramref name="item"/> as selected and ensures everything else is not.
        /// If the <paramref name="item"/> is null then everything is unselected.
        /// </summary>
        /// <param name="item"></param>
        public void SetSelectedItem(ListViewItem item)
        {
            int index = -1;
            if (item != null)
            {
                index = this.IndexFromContainer(item);
            }

            for (int i = 0; i < this.Items.Count; i++)
            {
                var lvi = (ListViewItem)this.ContainerFromIndex(i);

                if (lvi != null)
                {
                    if (i != index)
                    {
                        lvi.IsSelected = false;
                    }
                    else if (i == index)
                    {
                        lvi.IsSelected = true;
                    }
                }
            }
        }
开发者ID:cheahengsoon,项目名称:The-Asocial-Network,代码行数:30,代码来源:NavMenuListView.cs


示例4: buttonAddPerson_Click

 private async void buttonAddPerson_Click(object sender, RoutedEventArgs e)
 {
     var dialog = new ContentDialog();
     dialog.Title = "Add a person to your list";
     dialog.Content = new TextBox();
     dialog.PrimaryButtonText = "Add";
     dialog.IsPrimaryButtonEnabled = true;
     var result = await dialog.ShowAsync();
     if (ContentDialogResult.Primary == result)
     {
         try
         {
             var textBox = (TextBox)dialog.Content;
             string text = textBox.Text;
             if (text != "")
             {
                 Person person = new Person(text);
                 ListViewItem item = new ListViewItem
                 {
                     Content = person.Name,
                     Tag = person
                 };
                 listViewPerson.Items.Add(item);
                 person.Save();
             }
         }
         catch (NullReferenceException)
         {
         }
     }
 }
开发者ID:yann510,项目名称:HolidayList,代码行数:31,代码来源:MainPage.xaml.cs


示例5: SetSelectedItem

        /// <summary>
        ///     Mark the <paramref name="item" /> as selected and ensures everything else is not.
        ///     If the <paramref name="item" /> is null then everything is unselected.
        /// </summary>
        /// <param name="item"></param>
        public void SetSelectedItem(ListViewItem item)
        {
            if (Items == null) return;

            var index = -1;
            if (item != null)
            {
                index = IndexFromContainer(item);
            }

            for (var i = 0; i < Items.Count; i++)
            {
                var lvi = (ListViewItem) ContainerFromIndex(i);

                if (lvi == null) continue;

                if (i != index)
                {
                    lvi.IsSelected = false;
                }
                else if (i == index)
                {
                    lvi.IsSelected = true;
                }
            }
        }
开发者ID:jgodinez,项目名称:MoneyManager,代码行数:31,代码来源:NavMenuListView.cs


示例6: ItemInvoked

 private void ItemInvoked(ListViewItem obj)
 {
     var menuItem = obj?.Content as SplitViewPaneMenuItem;
     if (menuItem != null)
     {
         this.NavigationService.Navigate(menuItem.AssociatedPage, menuItem.Parameters);
     }
 }
开发者ID:jamesmcroft,项目名称:Windows-Universal-SplitViewTemplate,代码行数:8,代码来源:MainPageViewModel.cs


示例7: GenerateMatchList

 void GenerateMatchList()
 {
     MatchList.Items.Clear();
     foreach (Match m in bracket.Matches)
     {
         ListViewItem temp = new ListViewItem();
         temp.Content = m.ToString();
         MatchList.Items.Add(temp);
     }
 }
开发者ID:readyforchaos,项目名称:AppathonFT,代码行数:10,代码来源:Dashboard.xaml.cs


示例8: writeToList

        public void writeToList(ListView listView, ListViewItem itm)
        {
            foreach (var line in File.ReadLines(fileName))
            {

                itm = new ListViewItem();
                itm.FontFamily = font;
                itm.Content = line;
                listView.Items.Add(itm);
            }
        }
开发者ID:davidsjoo,项目名称:App4,代码行数:11,代码来源:FileHandler.cs


示例9: GenerateMatchList

        void GenerateMatchList()
        {
            MatchList.Items.Clear();

            for (int i = bracket.CurrentMatch; i < bracket.MatchCount; i++)
            {
                ListViewItem temp = new ListViewItem();
                temp.Content = bracket.Matches[i].ToString();
                MatchList.Items.Add(temp);
            }

        }
开发者ID:readyforchaos,项目名称:AppathonFT,代码行数:12,代码来源:Dashboard.xaml.cs


示例10: button_Click

 private void button_Click(object sender, RoutedEventArgs e)
 {
     if (!string.IsNullOrWhiteSpace(textBox.Text))
     {
         text = textBox.Text;
         itm = new ListViewItem();
         itm.FontFamily = font;
         itm.Content = text;
         listView.Items.Add(itm);
         fh.writeToFile(text);
         textBox.Text = empty;
     }
 }
开发者ID:davidsjoo,项目名称:App4,代码行数:13,代码来源:MainPage.xaml.cs


示例11: GenerateLeaderboard

        void GenerateLeaderboard()
        {
            Leaderboard.Items.Clear();

            foreach (Player p in bracket.Players)
            {
                ListViewItem temp = new ListViewItem();
                temp.FontFamily = font;
                temp.Content = p.ToString();
                Leaderboard.Items.Add(temp);
            }

        }
开发者ID:readyforchaos,项目名称:AppathonFT,代码行数:13,代码来源:Dashboard.xaml.cs


示例12: NavMenuList_ItemInvoked

        private void NavMenuList_ItemInvoked(object sender, ListViewItem listViewItem)
        {
            var item = (NavMenuItem)((NavMenuListView)sender).ItemFromContainer(listViewItem);

            if (item != null)
            {
                if (item.DestPage != null &&
                    item.DestPage != this.Frame.CurrentSourcePageType)
                {
                    this.Frame.Navigate(item.DestPage, item.Arguments);
                }
            }
        }
开发者ID:SuchGlasha,项目名称:CashManagerDGK,代码行数:13,代码来源:SettingsPage.xaml.cs


示例13: SetSelectedItem

 public void SetSelectedItem(ListViewItem item)
 {
     if (Items == null)
         return;
     foreach (
         var cont in
             Items.Select(i => (ListViewItem) ContainerFromItem(i)).Where(cont => cont != null && cont != item))
     {
         cont.IsSelected = false;
     }
     if (item != null)
         item.IsSelected = true;
 }
开发者ID:liqinghuang,项目名称:SplitViewMenuUWP,代码行数:13,代码来源:NavMenuListView.cs


示例14: MainPage

 public MainPage()
 {
     this.InitializeComponent();
     var db = new SQLiteConnection(new SQLitePlatformWinRT(), Path.Combine(ApplicationData.Current.LocalFolder.Path, "Storage.sqlite"));
     if (!db.TableMappings.Any()) db.CreateTable<Person>();
     List<Person> people = (from p in db.Table<Person>() select p).ToList();
     foreach (var person in people)
     {
         ListViewItem item = new ListViewItem();
         item.Content = person.Name;
         item.Tag = person;
         listViewPerson.Items.Add(item);
     }
 }
开发者ID:yann510,项目名称:HolidayList,代码行数:14,代码来源:MainPage.xaml.cs


示例15: UpdateList

 private void UpdateList()
 {
     Items.Clear();
     foreach (var group in ItemsSource)
     {
         var headerViewItem = new ListViewItem { Content = group, ContentTemplate = GroupHeaderTemplate, Tag = this };
         Items.Add(headerViewItem);
         foreach (var item in (IEnumerable)group)
         {
             var viewItem = new ListViewItem { Content = item, ContentTemplate = ItemTemplate };
             Items.Add(viewItem);
         }
     }
 }
开发者ID:yukiyuki,项目名称:MyToolkit,代码行数:14,代码来源:LongListView.cs


示例16: SetSelectedItem

        public void SetSelectedItem(ListViewItem item)
        {
            int index = -1;

            if (item != null)
                index = IndexFromContainer(item);

            for (int i = 0; i < Items.Count; i++)
            {
                var listViewItem = (ListViewItem)ContainerFromIndex(i);

                if (listViewItem != null)
                    listViewItem.IsSelected = i == index;
            }
        }
开发者ID:TommasoScalici,项目名称:AppShell,代码行数:15,代码来源:MenuListView.cs


示例17: AddClasses

        /// <summary>
        ///     Adds all classes
        /// </summary>
        public void AddClasses()
        {
            // Get list of all classes
            List<Class> classes = DataHandler.GetClasses();

            // Create header
            ListViewItem header = new ListViewItem
            {
                HorizontalContentAlignment = HorizontalAlignment.Stretch,
                Padding = new Thickness(0),
                Margin = new Thickness(0, 0, 0, 5),
                BorderBrush = MainPage.BlueBrush,
                BorderThickness = new Thickness(0, 0, 0, 1),
                IsHitTestVisible = false
            };

            // Container
            Grid content = new Grid();

            // Header text
            TextBlock txt = new TextBlock
            {
                FontSize = 30,
                Foreground = MainPage.BlueBrush,
                Text = "Class List"
            };

            // Add content
            content.Children.Add(txt);
            header.Content = content;
            ClassList.Items?.Add(header);

            // Generate a class panel for each class
            IEnumerable<ListViewItem> list = classes.Select(c => ClassInfoFactory.CreateClassInfoPanel(ClassList, c));

            // Null checking
            IEnumerable<ListViewItem> listViewItems = list as ListViewItem[] ?? list.ToArray();

            // Create spacers, assign spacers to classes, add items
            foreach (ListViewItem panel in listViewItems)
            {
                ListViewItem spacer = ClassInfoFactory.CreateSpacer();
                panel.Tag = spacer;
                ClassList.Items?.Add(panel);
                ClassList.Items?.Add(spacer);
            }
        }
开发者ID:jkralicky,项目名称:TaskPlanner,代码行数:50,代码来源:Classes.xaml.cs


示例18: MainPage

 public MainPage()
 {
     this.InitializeComponent();
     MainPageVM = App.Current.Resources["MainPageVM"] as MainPageViewModel;
     var appView = ApplicationView.GetForCurrentView();
     appView.TitleBar.BackgroundColor = Colors.Black;
     appView.TitleBar.ForegroundColor = Colors.White;
     appView.TitleBar.ButtonBackgroundColor = Colors.Black;
     appView.TitleBar.ButtonForegroundColor = Colors.White;
     var pane = MainPageView.Pane as StackPanel;
     pane.DataContext = MainPageVM.PageList;
     foreach (var item in MainPageVM.PageList)
     {
         var itemElement = new ListViewItem() { DataContext = item, ContentTemplate = (DataTemplate)Resources["ListViewItemDataTemplate"], Tag = item.PageTitle };
         itemElement.Tapped += new TappedEventHandler(ListViewItemTapped);
         pane.Children.Add(itemElement);
     }
 }
开发者ID:EvaRichie,项目名称:UWP1.0,代码行数:18,代码来源:MainPage.xaml.cs


示例19: MainPage

        public MainPage()
        {
            this.InitializeComponent();

            //BindingListView绑定到数据源  数据源自动加载数据
            BindingListView.ItemsSource = _binding_list_blogs = new CNBlogList();

            //手动向UnBindingListView中添加一个与要显示的数据不同的项
            ListViewItem different_item = new ListViewItem();
            different_item.Content = "我是单独不同的一项";
            different_item.HorizontalContentAlignment = HorizontalAlignment.Center;
            UnBindingListView.Items.Add(different_item);

            //手动向UnBindingListView中添加一个按钮项  点击手动加载数据
            ListViewItem loading_more = new ListViewItem();
            loading_more.Content = "点击加载更多...";
            loading_more.HorizontalContentAlignment = HorizontalAlignment.Center;
            loading_more.Tapped += loading_more_Tapped;
            UnBindingListView.Items.Add(loading_more);
        }
开发者ID:jango2015,项目名称:Blogs,代码行数:20,代码来源:MainPage.xaml.cs


示例20: Activity_Tapped

        private void Activity_Tapped(object sender, TappedRoutedEventArgs e)
        {
            Details.Items.Clear();
            List<Activity> activities = Activity.GetList();

            foreach(Activity a in activities)
            {
                //add new ListViewItem with listItem style and text matching the string applied in activity class.
                ListViewItem item = new ListViewItem
                {
                    Style = (Style)Application.Current.Resources["listItem"],
                    Content = new TextBlock
                    {
                        Style = (Style)Application.Current.Resources["listItemText"],
                        Text = a.ActivityName
                    }                                       
                };
                
                Details.Items.Add(item);
            }
        }
开发者ID:nateyb93,项目名称:MonkeySeeMonkeyDo,代码行数:21,代码来源:MainPage.xaml.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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