С .net maui, при создании CollectionView из списка, как мне получить доступ к другому списку, чтобы получить детали на оC#

Место общения программистов C#
Anonymous
С .net maui, при создании CollectionView из списка, как мне получить доступ к другому списку, чтобы получить детали на о

Сообщение Anonymous »


Я все еще новичок в xaml и .net maui, но даже не знаю, какие условия поиска использовать. Я хочу перечислить сегодняшние уведомления о задачах в формате xaml с представлением коллекции. Я хочу, чтобы этот список при отображении в представлении коллекции xaml извлекал сведения из другого списка, используя TaskID в качестве ключа идентификатора.
Например, примерно:

Код: Выделить всё

    class Notification:
int Id;
int TaskID;
int Title;
DateTime NotificationTime;

class Task:
int Id;
string Name;
string Details;

Код: Выделить всё

    UpcomingNotificationsViewModel:

List NotificationsList { get; set; }
List TasksList { get; set; }

async void LoadData()
{
var result = from s in NotificationsList
where s.NotificationTime.Date == today
group s by s.NotificationTime into g
select new GroupedNotification{ NotificationTime = g.Key, Notification = g.ToList() };

GroupedNotifications = result;
}

public class GroupedNotification
{
public DateTime NotifyTime { get; set; }
public List Notification { get; set; }
}
In the XAML, while iterating over CollectionView of Notifications, I want to also pull data from the TasksList like the Task.Name, Task.Details, and so on.

Код: Выделить всё

    















//this label below, how can I link it to TaskList and get details based on TaskID from this Notification List?











`
I tried several different iterations of this code, I tried searching for the past three hours, tried asking ChatGPT and Gemini but I cannot find what I'm looking for. I need someone to point me in the correct direction.


Источник: https://stackoverflow.com/questions/781 ... ccess-anot

Вернуться в «C#»