/// <summary> /// Inserts Content in the specific treeview node (category) specific to blog type data /// </summary> /// <param name="data">DocumentCategoricalData</param> /// <returns>RadTreeViewItem to be inserted in the category node</returns> private RadTreeViewItem InsertTreeViewItem_Blog(DocumentCategoricalData data) { RadTreeViewItem blogTreeViewItem = new RadTreeViewItem() { HorizontalContentAlignment = System.Windows.HorizontalAlignment.Stretch }; #region Header Grid headerGrid = new Grid(); headerGrid.ColumnDefinitions.Add(new ColumnDefinition() { Width = GridLength.Auto }); headerGrid.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(1, GridUnitType.Star) }); TextBlock headerCompanyName = new TextBlock() { Text = data.DocumentCompanyName,// + " (" + data.DocumentSecurityTicker + ")", VerticalAlignment = System.Windows.VerticalAlignment.Center, TextWrapping = TextWrapping.Wrap, Style = (Style)(this.Resources["TextBlockStyle"]) }; headerCompanyName.SetValue(Grid.ColumnProperty, 0); TextBlock headerUpdateNotification = new TextBlock() { Text = "*NEW*", Margin = new Thickness(2, 0, 0, 0), Foreground = new SolidColorBrush(Colors.Red), VerticalAlignment = System.Windows.VerticalAlignment.Center, TextWrapping = TextWrapping.Wrap, Visibility = Visibility.Collapsed, Style = (Style)(this.Resources["TextBlockStyle"]) }; updateInfo.Add(new UpdationData() { UpdationTag = UpdationTags.COMPANY_NAME, UpdationInfo = data, UpdationElement = headerUpdateNotification }); headerUpdateNotification.SetValue(Grid.ColumnProperty, 1); headerGrid.Children.Add(headerCompanyName); headerGrid.Children.Add(headerUpdateNotification); blogTreeViewItem.Header = headerGrid; #endregion #region Sub TreeView RadTreeViewItem blogSubTreeViewItem = new RadTreeViewItem() { HorizontalContentAlignment = System.Windows.HorizontalAlignment.Stretch }; #region Header Border blogSubTreeViewItemHeaderBorder = new Border() { BorderThickness = new Thickness(0, 1, 0, 1), BorderBrush = new SolidColorBrush(Colors.Black), HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch, Margin = new Thickness(-18, 0, 0, 0) }; Grid blogSubTreeViewItemHeaderGrid = new Grid() { FlowDirection = System.Windows.FlowDirection.LeftToRight }; blogSubTreeViewItemHeaderGrid.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto }); blogSubTreeViewItemHeaderGrid.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto }); #region Comment Listing Grid blogSubTreeViewItemHeaderGridCommentGrid = new Grid() { Margin = new Thickness(0, 5, 0, 0) }; blogSubTreeViewItemHeaderGridCommentGrid.SetValue(Grid.ColumnProperty, 0); blogSubTreeViewItemHeaderGridCommentGrid.ColumnDefinitions.Add(new ColumnDefinition() { Width = GridLength.Auto }); blogSubTreeViewItemHeaderGridCommentGrid.ColumnDefinitions.Add(new ColumnDefinition() { Width = GridLength.Auto }); blogSubTreeViewItemHeaderGridCommentGrid.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(1, GridUnitType.Star) }); foreach (CommentDetails comment in data.CommentDetails.OrderByDescending(record => record.CommentOn)) { blogSubTreeViewItemHeaderGridCommentGrid.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto }); TextBlock commentOnTextBlock = new TextBlock() { Text = comment.CommentOn.ToLocalTime().ToShortDateString(), VerticalAlignment = System.Windows.VerticalAlignment.Center, Margin = new Thickness(5, 0, 0, 0), Style = (Style)(this.Resources["TextBlockStyle"]) }; commentOnTextBlock.SetValue(Grid.RowProperty, blogSubTreeViewItemHeaderGridCommentGrid.RowDefinitions.Count - 1); commentOnTextBlock.SetValue(Grid.ColumnProperty, 0); TextBlock commentByTextBlock = new TextBlock() { Text = comment.CommentBy, VerticalAlignment = System.Windows.VerticalAlignment.Center, Margin = new Thickness(5, 0, 0, 0), Style = (Style)(this.Resources["TextBlockStyle"]) }; commentByTextBlock.SetValue(Grid.RowProperty, blogSubTreeViewItemHeaderGridCommentGrid.RowDefinitions.Count - 1); commentByTextBlock.SetValue(Grid.ColumnProperty, 1); TextBlock commentTextBlock = new TextBlock() { Text = comment.Comment, VerticalAlignment = System.Windows.VerticalAlignment.Center, Margin = new Thickness(5, 0, 5, 0), Style = (Style)(this.Resources["TextBlockStyle"]) }; commentTextBlock.SetValue(Grid.RowProperty, blogSubTreeViewItemHeaderGridCommentGrid.RowDefinitions.Count - 1); commentTextBlock.SetValue(Grid.ColumnProperty, 2); blogSubTreeViewItemHeaderGridCommentGrid.Children.Add(commentOnTextBlock); blogSubTreeViewItemHeaderGridCommentGrid.Children.Add(commentByTextBlock); blogSubTreeViewItemHeaderGridCommentGrid.Children.Add(commentTextBlock); } blogSubTreeViewItemHeaderGrid.Children.Add(blogSubTreeViewItemHeaderGridCommentGrid); #endregion #region Content Updation Grid blogSubTreeViewItemHeaderGridUpdationGrid = new Grid(); blogSubTreeViewItemHeaderGridUpdationGrid.SetValue(Grid.RowProperty, 1); blogSubTreeViewItemHeaderGridUpdationGrid.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(1, GridUnitType.Star) }); blogSubTreeViewItemHeaderGridUpdationGrid.ColumnDefinitions.Add(new ColumnDefinition() { Width = GridLength.Auto }); blogSubTreeViewItemHeaderGridUpdationGrid.ColumnDefinitions.Add(new ColumnDefinition() { Width = GridLength.Auto }); blogSubTreeViewItemHeaderGridUpdationGrid.ColumnDefinitions.Add(new ColumnDefinition() { Width = GridLength.Auto }); TextBox documentCommentUpdation = new TextBox() { Margin = new Thickness(5), Style = (Style)(this.Resources["TextBoxStyle"]) }; documentCommentUpdation.SetValue(Grid.ColumnProperty, 0); TextBlock alertLabel = new TextBlock() { Text = "Alert:", Margin = new Thickness(5, 0, 0, 0), VerticalAlignment = System.Windows.VerticalAlignment.Center, FontWeight = FontWeights.Bold, Style = (Style)(this.Resources["TextBlockStyle"]) }; alertLabel.SetValue(Grid.ColumnProperty, 1); RadComboBox userListingComboBox = new RadComboBox() { Margin = new Thickness(5, 0, 0, 0), Style = (Style)(this.Resources["RadComboBoxStyle"]) }; userListingComboBox.SetValue(Grid.ColumnProperty, 2); RadButton commentUpdationButton = new RadButton() { Margin = new Thickness(5, 0, 5, 0), Content = "+", Style = (Style)(this.Resources["RadButtonStyle"]) }; commentUpdationButton.SetValue(Grid.ColumnProperty, 3); blogSubTreeViewItemHeaderGridUpdationGrid.Children.Add(documentCommentUpdation); blogSubTreeViewItemHeaderGridUpdationGrid.Children.Add(alertLabel); blogSubTreeViewItemHeaderGridUpdationGrid.Children.Add(userListingComboBox); blogSubTreeViewItemHeaderGridUpdationGrid.Children.Add(commentUpdationButton); #endregion blogSubTreeViewItemHeaderGrid.Children.Add(blogSubTreeViewItemHeaderGridUpdationGrid); blogSubTreeViewItemHeaderBorder.Child = blogSubTreeViewItemHeaderGrid; blogSubTreeViewItem.Header = blogSubTreeViewItemHeaderBorder; #endregion blogTreeViewItem.Items.Add(blogSubTreeViewItem); #endregion return(blogTreeViewItem); }