Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Infragistics XamDatagrid column resizing left to right

I use XamDataGrid to show table with really long header names. Most important part of the header name is it's suffix.

Is there any way that I can configure column headers the way that when the column width is shorter than text size i will see the suffix as header?

Example:

Required outcome:

[...SUFFIX1][...SUFFIX2]

Instead of default behaviour I have:

[Prefix....][Prefix....]
like image 820
Sergey Kucher Avatar asked Nov 26 '25 06:11

Sergey Kucher


1 Answers

A way is to create ContentTemplate for LabelPresenter :

<Setter Property="ContentTemplate">
                    <Setter.Value>
                        <DataTemplate>
                            <TextBlock VerticalAlignment="Stretch" HorizontalAlignment="Stretch" FlowDirection="RightToLeft"  Text="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Content}"
TextTrimming="CharacterEllipsis">

                            </TextBlock>

                        </DataTemplate>
</Setter.Value>

the result looks like :

enter image description here

for showing the suffix part you can use textwrapping and increasing the height of the LabelPresenters to wrap text. It's a better way to show whole column name and it looks good also.(obviously if this servers your purpose)

<Setter Property="Height" Value="50"/>  

set labelPresenter height in style & result looks like :

enter image description here

But if you want strictly as you mentioned then use a control as in below link and then use that control in content template of label presenter.

Textbox with ellipsis

like image 53
Kylo Ren Avatar answered Nov 28 '25 19:11

Kylo Ren



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!