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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T08:26:32+00:00 2026-06-13T08:26:32+00:00

I have a checkbox located in a grid with a column span of 3,

  • 0

I have a checkbox located in a grid with a column span of 3, where 2 of the columns are resizable, and can be resized during runtime.

I want the checkbox to show ellipsis when its text doesn’t fit, but can’t get this to work.

Here is my XAML code.

<Grid>
     <Grid.ColumnDefinitions>
          <ColumnDefinition Width="Auto" />
          <ColumnDefinition Width="*" />
          <ColumnDefinition Width="*" />
          <ColumnDefinition Width="Auto" />
     </Grid.ColumnDefinitions>
...
    <CheckBox IsEnabled="False"  Grid.Row="2" Padding="5" Margin="11,12,0,0" Name="chkSelectedCat" VerticalAlignment="Top" HorizontalAlignment="Stretch" Grid.ColumnSpan="3">
         <AccessText Text="Search in selected category only." TextTrimming="CharacterEllipsis"/>
    </CheckBox>

Thanks in advance for your help.

EDIT

The CheckBox in question is located within a Grid, which is in turn contained within a GroupBox, which is in a column adjacent to a column which is resized using a GridSplitter.

  • 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-13T08:26:33+00:00Added an answer on June 13, 2026 at 8:26 am

    The problem was that the GroupBox allots infinite width to its child controls, as discussed at this MSDN forum thread.

    In fact, when setting a MaxWidth to the CheckBox, text trimming worked and the ellipsis were displayed.

    However the CheckBox maximum width needed to be changed during runtime.

    I tried using a MultiValueConverter to bind the MaxWidth of the CheckBox to the total ActualWidth of the three columns, but the Convert method was only being called during initialisation (again I think this is something to do with how the GroupBox assigns sizes to its child controls).

    Anyway I managed to achieve what I wanted by removing the ChechkBox‘s AccessText and using a TextBlock in a StackPanel in its stead, and then surrounding everything with a Border.

    <Border Grid.Row="2" Grid.ColumnSpan="3" Name="chkBorder" SizeChanged="chkBorder_SizeChanged">
         <StackPanel Orientation="Horizontal" VerticalAlignment="Stretch">
                   <CheckBox IsEnabled="False" Padding="0" Margin="11,7,0,5" Name="chkSelectedCat"  VerticalAlignment="Center"/>
                   <TextBlock Foreground="Black" Name="txtChkSelectedCat" Text="Search in selected category only." TextTrimming="CharacterEllipsis" TextWrapping="NoWrap" VerticalAlignment="Center" Margin="0,5,5,5"/>
          </StackPanel>
    </Border>
    

    When the size of the Border is changed, I update the Width of the StackPanel in the event handler, and the text in the TextBox trims accordingly.

    private void chkBorder_SizeChanged(object sender, SizeChangedEventArgs e)
    {
         this.txtChkSelectedCat.Width = this.chkBorder.ActualWidth - this.chkSelectedCat.ActualWidth - 11 - 5 - 5; // margins
    }
    

    Hope this helps someone in the future (even though it is sort of a hack).

    UPDATE

    If you can eliminate the StackPanel and use a Grid instead, TextTrimming works automatically, without having to do any event handling, as shown below.

    <Grid Grid.Row="2" Grid.ColumnSpan="3">
         <Grid.ColumnDefinitions>
              <ColumnDefinition Width="Auto" />
              <ColumnDefinition Width="*" />
         </Grid.ColumnDefinitions>
         <CheckBox Grid.Column="0" IsEnabled="False" Padding="0" Margin="11,7,0,5" Name="chkSelectedCat" VerticalAlignment="Center" ToolTipService.ShowOnDisabled="True"/>
         <TextBlock Grid.Column="1" Foreground="Black"  Name="txtChkSelectedCat" Text="Search in selected category only." TextTrimming="CharacterEllipsis" TextWrapping="NoWrap" VerticalAlignment="Center" Margin="0,5,5,5" MouseLeftButtonDown="txtChkSelectedCat_MouseLeftButtonDown" ToolTip="{Binding ElementName=chkSelectedCat, Path=ToolTip}" />
    </Grid>
    

    Make sure to set the Width of the column containing the textbox to "*", because "Auto" basically tells the TextBox that it can have as much space as it wants, so TextTrimming would not work.

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

Sidebar

Related Questions

i have checkbox list printed in one column, but i need it to print
I have a checkbox that I do not want the user to have direct
I have added checkbox selection model to grid panel. It works fine in IE8
I have preferences page. It has field 'Show info screen' (as checkbox). I have
I have checkbox in preferences. I want to keep screen on if checkbox is
I had a doubt that can we have Checkbox in Dropdown in Oracle Forms?
Without using listactivity, in a simple activity how can I have checkbox at the
I have a very similar problem to the post located here: Telerik grid with
I`m quite begginer at WPF. I have checkBox and I want that every check
I have a checkbox in a column of a DataGridView. Right now I got

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.