public TitleCardView() { InitializeComponent(); DataContextChanged += (s, e) => { ViewModel = DataContext as TitleCardViewModel; }; }
private void InitializeTitles() { Titles = new ObservableCollection <UIElement>(); foreach (var title in _titlesMarkup.Titles) { var tvm = new TitleCardViewModel(title.Item); var tc = new TitleCard { DataContext = tvm }; Grid.SetRow(tc, title.Row); Grid.SetColumn(tc, TitleRowsCount + title.Column); Grid.SetRowSpan(tc, title.RowSpan); Grid.SetColumnSpan(tc, title.ColumnSpan); Titles.Add(tc); } }