This is a migrated thread and some comments may be shown as answers.

Can't resize column with TextTrimming="WordEllipse" and Width="*"

3 Answers 372 Views
GridView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Abdulrahman Omran
Top achievements
Rank 1
Abdulrahman Omran asked on 17 Aug 2011, 02:30 AM
Hi,

I will try to explain the problem i'm having briefly. Basically, I'm trying to have one column in the grid to take all available space and if the text exceeds the max possilbe width then the text will be trimmed.

I have this line in my xaml:
<telerik:GridViewDataColumn Width="*" IsReadOnly="True" IsGroupable="True" TextAlignment="Left" DataMemberBinding="{Binding IntComments, Mode=TwoWay, ValidatesOnDataErrors=False}" Header="Internal Comment" TextTrimming="WordEllipsis" >the 


This works as expected. However, it introduces another problem. When the user increases the width of the column then this becomes the new MinWidth and the user can't decrease the width of the column ! ..

I hope there is a solution for this problem.

Thank you,
Abdul

3 Answers, 1 is accepted

Sort by
0
Vanya Pavlova
Telerik team
answered on 17 Aug 2011, 08:14 AM
Hello Abdul,

 


Generally the behavior you described is the expected one. When you set the Width property of a column to star ("*") it will fill the available space and TextTrimming will not work for this column, which is normally. You have to set a fixed width for that column in order to get it work. 

 

Regards,
Vanya Pavlova
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get now >>

0
Abdulrahman Omran
Top achievements
Rank 1
answered on 18 Aug 2011, 10:13 PM
Hi,

I guess I didn't explain myself well enough in the previous post.

I meant that the column now is stretching to fill the available space and the trimming is also working. This isn't a problem rather as you described it, it's the expected behaviour.

The problem is that the user now can't resize the column. Lets say i have extended the column to be 600 px wide so that the scrollbar is shown and now  I want to make the column width smaller, the column wouldn't resize. I can't increase the width but not decrease it.


Thank you.
Abdul
0
Vanya Pavlova
Telerik team
answered on 19 Aug 2011, 01:32 PM
Hello Abdulrahman,

 

We have spent some time to investigate what might be causing this behavior. Indeed a single star sized column cannot be increased/decreased by design. You should add an additional star-size column and everything should work as expected:


<telerik:RadGridView x:Name="radGridView" AutoGenerateColumns="False" ItemsSource="{Binding Collection}">
            <telerik:RadGridView.Columns>
                <telerik:GridViewDataColumn Header="OP1" Width="0.8*" TextTrimming="WordEllipsis"   DataMemberBinding="{Binding Property1}"/>
                <telerik:GridViewDataColumn Header="OP1" Width="0.2*" TextTrimming="WordEllipsis" DataMemberBinding="{Binding Property1}"/>
            </telerik:RadGridView.Columns>
</telerik:RadGridView>     


Within this definiton the Width of the first column will be 0.8 percent of the available space, the second one is 0.2 percent of the available space.

In a similar way you may arrange the rest columns in your RadGridView. 

Hope this helps!

Greetings,
Vanya Pavlova
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get now >>

Tags
GridView
Asked by
Abdulrahman Omran
Top achievements
Rank 1
Answers by
Vanya Pavlova
Telerik team
Abdulrahman Omran
Top achievements
Rank 1
Share this question
or