public ChannelWindow(ChatControl control) { InitializeComponent(); this.DataContext = this; this.Control = control; control.SetValue(Grid.RowProperty, 1); control.SetValue(Grid.ColumnSpanProperty, 2); grdRoot.Children.Add(control); control.Session.StateChanged += new EventHandler<EventArgs>(Session_StateChanged); }