Group items by date in a listview - c#

I would like to create groups by day for my items in a ListView (like a LongListSelector in WP7). I succeed with alphabetical items thanks to the CharacterGroupings class but I try to find the best way with timestamp. Do you have any idea to help me sorting items by creating by month/day, then put all the relating items in these groups ?

Related

c# listbox numerical order of items

Hello I'm searching throught internet for hours but still I can not find the answer. (or I just don't know how to ask)
I need a simple numerical order of items in listbox fe. I am adding every 3rd items to listbox from txt file.
When I have this in txt file:
Acc 4
name4
pass4
Acc 5
name5
pass5
I'll add to listbox only Acc4 and Acc5
And now when I select some item in listbox I want to know which one is selected but I don't want fe.: Acc6 (is selected) but I want to know Acc6is 3nd one in listbox (then order is 2)
PS: sorry for my end and thx for help
If you are looking for the index of the selected item in a listbox try
{listBoxName}.SelectedIndex
This will give you the index (0 based) of a selected item. https://learn.microsoft.com/en-us/dotnet/api/system.windows.forms.listbox.selectedindex?view=netframework-4.7.2
If you want the item try
{listBoxName}.SelectedItem
This gives the currently selected item https://learn.microsoft.com/en-us/dotnet/api/system.windows.forms.listbox.selecteditem?view=netframework-4.7.2

Dynamic grouping in a WPF ListView

I have a list with some items.
The items have a name, creation date, modification date, an owner and some other properties.
I want to diplay them in a WPF ListView and group them.
They shall be grouped a column selected from a dropdown (no grouping, group by name, group by owner, group by creation date).
I know how to bild a list view, bind the item list and createing a static group. There are a lot of good examples fpr static groups.
I need enabling/disabling grouping and changing the group.
How can ythis be done in WPF?
Clemens Hoffmann

Inserting and displaying a lot of items using Listbox

I am using listBox to show a lot of items (number of items>1000000). But it can show only the items which are in integer range. I have searched a lot, but I found nothing.
I want to know if there is any way to make listBox show items in "long" range?

Remove or add items in DataGridComboboxColumn on row add or delete

Here's my problem: I need to make a DataGrid with dynamic comboboxes using the WPF. If the value of a combobox is already used in the previous rows, the next ones, that will be added by the user, shouldn't contain the item already used.
In this image, the ITEM A shouldn't apear on the combobox of the second line.
I don't have ideia how to accomplish this, can anyone show me a light?
OBS: The DataGrid ItemsSource is binded to an ObservableCollection, and the DataGridComboBoxColumn ItemsSource is a List.
Thanks !!!
The ItemsSource of the combo doesn't have to be bound to an ObservableCollection, but it can help depending on exactly how you solve this.
When that cell goes in to edit mode the property the ItemsSource is bound to gets hit - so you can return a new list of items each time the getter is hit. Here is a very basic example to give you an idea:
public List<string> MyItemsSource
{
get
{
var myNewList = MyMasterList.ToList(); //create a (reference) copy of the master list (the items are not copied though, they remain the same in both lists)
if (PropertyA != null)
myNewList.Remove(PropertyA);
return myNewList;
}
}
So what you are creating and returning is a filtered version of your master list of all possible items. LINQ will be of great help to you here.
Alternatively you could keep just one static copy of the master list as an ObservableCollection, and simply remove items from that static copy as they get selected (and add them back in as they get unselected). Which option you choose will depend on how many times the list can be modified due to items being selected and how complicated it is to generate the list. I've used the dynamically generated list many times in the past, it's an option that works well in most cases.

How to select multiple items in multilistpicker windows phone 8

I need to display a list of items in list picker,Im using list picker with multiple selection mode.Is there any way to check the check boxes of multiple items from c#(without user's interaction).I found many ways to find the list of selected items but couldnt find how to set multiple items as selected from code behind.Please help.I tried using
for(int i=0;i<selecteditems.count;i++)
{
listpicker.SelectedItem=listpicker.Items[i];
}
This doesnt work ..
Use the SelectedItems property for setting multiple items as selected.
This may be help you
listpicker.SelectedItems = List<your selected items>;

Categories

Resources