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

Silverlight grid - row auto height base on cell content

5 Answers 98 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Yuk
Top achievements
Rank 1
Yuk asked on 17 Jun 2011, 11:20 AM
I have control with multiple line of data. How do I set the row to adjust the height base on the content



-------------------
row 1 content
row 1 content
row 1 content
-------------------
row 2 content
-------------------

5 Answers, 1 is accepted

Sort by
0
Maya
Telerik team
answered on 17 Jun 2011, 11:57 AM
Hi Yuk,

May you try to set the TextWrapping property of the column to "Wrap" ? For example:

<telerik:GridViewDataColumn DataMemberBinding="{Binding Name}" TextWrapping="Wrap" Width="100"/>
  
Let me know whether the suggested approach corresponds to your requirements.

Regards,
Maya
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Yuk
Top achievements
Rank 1
answered on 17 Jun 2011, 12:07 PM
It is  a custom control with text and images.

_________
- size , icon
   size,  icon
__________
+  size , icon
___________  
0
Maya
Telerik team
answered on 17 Jun 2011, 12:26 PM
Hi Yuk,

In order to provide you with an appropriate solution, I would need a bit more details. What is the custom control that you are implementing ? Do you create your own custom column or you define a CellTemplate in column ?
 

Best wishes,
Maya
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Yuk
Top achievements
Rank 1
answered on 17 Jun 2011, 12:31 PM
  <telerik:GridViewDataColumn SortMemberPath="Size" FooterTextAlignment="Right" >
                    <telerik:GridViewDataColumn.Header>
                        <ContentControl>
                            <StackPanel>
                                            <TextBlock Text="Size ('000m)" HorizontalAlignment="Left" />
                                 </StackPanel>
                        </ContentControl>
                          </telerik:GridViewDataColumn.Header>


                    <telerik:GridViewDataColumn.CellTemplate>
                        <DataTemplate>
                            <Controls:CumtomSizeCell DataContext="{Binding SizeViewModel}" />
                        </DataTemplate>
                    </telerik:GridViewDataColumn.CellTemplate>
          </telerik:GridViewDataColumn>


   public partial class CumtomSizeCell : UserControl
    {
        public CustomSizeCell()
        {
            InitializeComponent();
        }
    }
0
Maya
Telerik team
answered on 20 Jun 2011, 08:58 AM
Hello Yuk,

Based on the code-snippets provided, I get the impression that you may still implement the suggested approach for setting the TextWrapping property of the column. Is it not appropriate for your case ? You might also have to set the Width property of the column so that it is aware towards which size it has to wrap the content. 

Greetings,
Maya
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
GridView
Asked by
Yuk
Top achievements
Rank 1
Answers by
Maya
Telerik team
Yuk
Top achievements
Rank 1
Share this question
or