当前位置: 首页>>代码示例>>C#>>正文


C# Controls.ListViewItem类代码示例

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


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


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