當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。