This is my collection:
public ObservableCollection<CheckOutData> _CheckOutCollection = new ObservableCollection<CheckOutData>();
public ObservableCollection<CheckOutData> CheckOutCollection
{
get { return _CheckOutCollection; }
}
public class CheckOutData
{
public int ID { get; set; }
public string RoomType { get; set; }
public string RoomNumber { get; set; }
public decimal RoomPrice { get; set; }
public string RoomPriceWithCurrency { get; set; }
public decimal Discount { get; set; }
public decimal DiscountedPrice { get; set; }
public string DiscountedPriceWithCurrency { get; set; }
public string CheckIn { get; set; }
public string CheckOut { get; set; }
public int TotalDay { get; set; }
public string CheckOutHour { get; set; }
}
I have another window where i want to do following: Add CheckOutData public string serviceName{get;set}
how can this done? i dont even see checkoutdata in my child window.
So my main task is add new collection in checkoutdata and then rebind datagrid. Can anyone help me?
private CheckOut m_parent;
public AddActionService(CheckOut parent)
{
InitializeComponent();
m_parent = parent;
}
You might want to consider some sort of event aggregator. This way any form’s code (or ViewModel/Presenter, if you’re using MVVM/MVP) can send messages that are picked up by the aggregator and distributed to any other forms/ViewModels/Presenters that have subscribed to that event. This approach means your forms are no longer tightly coupled together. They literally have no reference to each other at all. They communicate through the event aggregator and they don’t even know if any objects are listening for those events.
You could also consider taking it one step further and going for a “Domain Events” style, that allows you to react to these events not just in UIs, but also in domain objects elsewhere in your system, including sending messages via external services to call web services, update databases, put messages in queues etc.