ContentControlWithTemplateSelector/DataViewModel.cs
(完整代码) 1021Busing System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ContentControlWithTemplateSelector
{
public class DataViewModel
{
public ObservableCollection<Room> Rooms { get; set; }
public DataViewModel()
{
Rooms = CreateRooms();
}
private ObservableCollection<Room> CreateRooms()
{
ObservableCollection<Room> rooms = new ObservableCollection<Room>();
for (int i = 0; i < 10000; i++)
{
var room = new Room { Index = i };
if (i % 3 == 0)
{
room.Name = "Room " + i;
if (i % 2 == 0)
{
room.ImageUri = new Uri( "ms-appx:///Assets/testImage.jpg");
}
}
rooms.Add(room);
}
return rooms;
}
}
}
24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明
AI 解读
登录后可用,每次 10 积分,解读结果公开显示在下面。
还没有人解读过这个文件。
