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 8255281
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T01:28:17+00:00 2026-06-08T01:28:17+00:00

I am working on displaying rows which are grouped on WPF DataGrid Group Header

  • 0

I am working on displaying rows which are grouped on WPF DataGrid

Group Header which I am currently displaying is a TextBlock, and the text displayed on the TextBlock is not selectable.

How can I make TextBlock text selectable so that I can copy the value.

Following is the XAML.

I am using following code to Bind data to the grid and group the data.

Entity:

public class AverageCounter
{
    public string CounterName { get; set; }
    public string Role { get; set; }
    public string RoleInstance { get; set; }
    public decimal CounterAverageValue { get; set; }
}

Code to Bind and Group.

var results = new ListCollectionView(queryResultSet);

if (results.GroupDescriptions != null)
{
    results.GroupDescriptions.Add(new PropertyGroupDescription("CounterName"));
}

dataGrid1.AutoGenerateColumns = true;
dataGrid1.ItemsSource = results;

XAML:

<Window x:Class="CheckPerfromanceCounters.MainWindow" 
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
        xmlns:local="clr-namespace:CheckPerfromanceCounters"
        Title="MainWindow" Height="390" Width="878">
    <Window.Resources>
        <local:AvgConverter x:Key="avgConverter"/>
    </Window.Resources>
    <Grid>

        <Button Content="Refresh" Height="23" HorizontalAlignment="Left" Margin="769,328,0,0" Name="button1"
            VerticalAlignment="Top" Width="75" Click="Button1Click" />
        <DataGrid AutoGenerateColumns="True" Height="310" HorizontalAlignment="Left" Margin="12,12,0,0"
              Name="dataGrid1" VerticalAlignment="Top" Width="832">
            <DataGrid.GroupStyle>
                <GroupStyle>
                    <GroupStyle.HeaderTemplate>
                        <DataTemplate>
                            <StackPanel>
                                <TextBlock Text="{Binding Path=CounterName}" />
                            </StackPanel>
                        </DataTemplate>
                    </GroupStyle.HeaderTemplate>
                    <GroupStyle.ContainerStyle>
                        <Style TargetType="{x:Type GroupItem}">
                            <Setter Property="Template">
                                <Setter.Value>
                                    <ControlTemplate TargetType="{x:Type GroupItem}">
                                        <Expander>
                                            <Expander.Header>
                                                <StackPanel Orientation="Horizontal">
                                                    <TextBlock Text="{Binding Path=Name}" FontStyle="Italic"/>

                                                    <TextBlock><Bold> - Average: </Bold></TextBlock>
                                                    <TextBlock Text="{Binding Converter={StaticResource avgConverter}}" />
                                                </StackPanel>
                                            </Expander.Header>
                                            <ItemsPresenter />
                                        </Expander>
                                    </ControlTemplate>
                                </Setter.Value>
                            </Setter>
                        </Style>
                    </GroupStyle.ContainerStyle>
                </GroupStyle>
            </DataGrid.GroupStyle>

        </DataGrid>

    </Grid>
</Window>

if you need anyother information please let me know.

  • 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-08T01:28:18+00:00Added an answer on June 8, 2026 at 1:28 am

    Use TextBox with IsReadOnly ="True" but also set the binding mode to oneWay :

    Text="{Binding Converter={StaticResource avgConverter}, Mode=OneWay}"

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

Sidebar

Related Questions

I'm currently working on a website which is displaying users tweets from the twitter
I am currently working on a GWT project where I am displaying an HTML
I'm working on this JSF table which is used for displaying data. When I
I have UI which displaying status of long-running operations (downloading some text files from
I'm currently displaying RadioButtons in my application as rows of ToggleButtons (see my last
I am currently working on a Silverlight 4.0 Application that displays about 13.000 rows
I am working on a Website which is displaying all the apps from the
I am working on an application in which data is displaying from back end
I have a inner join statment which is working 90% as it is displaying
I'm working on displaying a page of classifieds in table rows. The problem I'm

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.