Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8858927
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T14:56:17+00:00 2026-06-14T14:56:17+00:00

I need to show some data in a structured way with colored letters and

  • 0

I need to show some data in a structured way with colored letters and rows with background colors.

I made a grid in a WPF Window. It shows the textboxes and some of the labels, but none of the text. Also the column header, last column, gridseperators, grid bot and left edges are invisible.

Current status of my WPF window

My grid is called propertiesView.

Code for adding header elements (labels)

    private void AddHeaderElement(string text, int row, int col)
    {
        Label headerElement = new Label();
        headerElement.Height = cellHeight;
        headerElement.Width = cellWidth;
        headerElement.DataContext = text;
        headerElement.Background = headerBackground;
        headerElement.BorderBrush = new SolidColorBrush(Color.FromRgb(120, 120, 120));
        headerElement.BorderThickness = new Thickness(3);

        propertiesView.Children.Add(headerElement);
        Grid.SetRow(headerElement, row);
        Grid.SetColumn(headerElement, col);
    }

Code for adding cells

RichTextBox cell = new RichTextBox();

cell.Height = cellHeight;
cell.Width = cellWidth;
cell.ToolTip = toolTip;
cell.DataContext = text;
cell.Background = rowDifferent;

propertiesView.Children.Add(cell);

//box.SetValue(Grid.RowProperty, rowCount);
//box.SetValue(Grid.ColumnProperty, columnCount);
Grid.SetRow(cell, rowCount);
Grid.SetColumn(cell, columnCount);

Code for adding grid seperators

GridSplitter colSeperator = new GridSplitter();
colSeperator.Margin = new Thickness(-2.5, 0, 0, 0);
colSeperator.Width = 5;
colSeperator.ResizeDirection = GridResizeDirection.Columns;
colSeperator.ResizeBehavior = GridResizeBehavior.CurrentAndNext;
colSeperator.VerticalAlignment = VerticalAlignment.Stretch;
colSeperator.HorizontalAlignment = HorizontalAlignment.Left;

propertiesView.Children.Add(colSeperator);
Grid.SetColumn(colSeperator, 0);
Grid.SetRowSpan(colSeperator, totalRows + 1);

The tooltips do show the right text.
I tried using TextBox instead of RichTextBox and setting all this stuff in the class constructor instead of a seperate method.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T14:56:18+00:00Added an answer on June 14, 2026 at 2:56 pm

    Turns out I needed labels with textblocks, spans and runs.
    Style can be added on the span (through properties like Foreground, TextDecoration or FontWeight). Add the text to the span inside a Run, then add all spans to a textblock, which is shown through a label.

    Span span = new Span();
    span.Foreground = Brushes.Black;
    span.Inlines.Add(new Run("Text"));
    
    textBlock.Inlines.Add(span);
    
    Label cell = new Label();
    
    cell.MinHeight = cellHeight;
    cell.MaxWidth = cellWidth * 3;
    cell.MinWidth = cellWidth;
    cell.ToolTip = "toolTip";
    cell.BorderThickness = new Thickness(2);
    
    TextBlock cellText = new TextBlock();
    cellText.HorizontalAlignment = HorizontalAlignment.Stretch;
    cellText.TextWrapping = TextWrapping.WrapWithOverflow;
    
    cell.Content = cellText;
    

    The text works now, I should be able to get the gridseperators working.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to show some data in a grid-like format. For that purpose, I
I need to show some information in a graph, the data is held in
In my app I have need to trigger show some custom view when status
I need to make a WebView show some web pages where some parts are
I've been googling this for long time! I need to show images on some
I need to create a slide show of some images that can go full
I need to show for every link, dynamically some text with Java-Script (jQuery). The
For a few days a have some problem. I need to show simple ProgressBar
I display set of images(small). I need to show the larger image(300*300) at some
I need show a notication modal window.. But since its a fluid layout the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.