我正在使用WindowsStore GridApp模板在VS2012 c#/ xaml中创建Windows应用商店应用。 我正在使用此模板所具有的Group和Items页面。
在组页面中,我显示了一个Rooms列表 - 数据源是RoomObjects
public class RoomsObject : LivingDataCommon
{
public RoomsObject()
: base(String.Empty, String.Empty)
{
}
public RoomsObject(String ID, String title)
: base(ID, title)
{ }
//adds Actors to collection of a Room, will be used for Rooms pages
private ObservableCollection<ActorsObject> _actors = new ObservableCollection<ActorsObject>();
public ObservableCollection<ActorsObject> Actors
{
get { return this._actors; }
}
}
在项目页面中,我显示每个房间都有的演员列表 - 数据源是ActorsObjects
public class ActorsObject : LivingDataCommon
{
public ActorsObject()
: base(String.Empty, String.Empty)
{
}
public ActorsObject(String ID, String title, Boolean homepage,String function, RoomsObject room, double currentValue, ActorsType type, AllActors allactors)
: base(ID, title)
{
this._function = function;
this._room = room;
this._currentValue = currentValue;
this._type = type;
this._homepage = homepage;
this._all = allactors;
}
//set home page appearance
private Boolean _homepage = false;
public static Boolean Homepage = false;
//sets value of an actor
private double _currentValue;
public double CurrentValue
{
get { return this._currentValue; }
set { this.SetProperty(ref this._currentValue, value); }
}
//sets and gets function code
private string _function = string.Empty;
public string Function
{
get { return this._function; }
set { this.SetProperty(ref this._function, value); }
}
//gets room properity
private RoomsObject _room;
public RoomsObject Room
{
get { return this._room; }
set { this.SetProperty(ref this._room, value); }
}
private ActorsType _type;
public ActorsType Type
{
get { return this._type; }
set { this.SetProperty(ref this._type, value); }
}
private AllActors _all;
public AllActors All
{
get { return this._all; }
set { this.SetProperty(ref this._all, value); }
}
}
当我在Items页面中选择一个Actor时,我的appbar出现了,我需要在我的pinButton上允许该Actor也显示在Home.xaml上。
我假设我应该创建一个空的ObservableCollection并向其添加所选项目,然后将该集合用作Home.xaml的数据源,但我是c#的新手,我无法让它工作..
请提供任何建议,代码或其他一些方法吗?
答案 0 :(得分:0)