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

[Solved] Assign Column Width to Child Control inside Datatemplate

1 Answer 149 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.
Prakash
Top achievements
Rank 1
Prakash asked on 15 Oct 2010, 12:13 PM
HI
  
Here is my datatemplate 
  
  
<DataTemplate x:Key="iLableAreaCellTemplate">
  
<StackPanel Orientation="Horizontal" >   
  
    <iLabel LabelText="{Binding Column1}" IsWordwrap="False" Mandatory="False" Width={Binding....} />
  
</StackPanel>
  
</DataTemplate> 
  
Assign to the gridviewdatacolumn's cell template
  
  
  
gvc.CellTemplate = Resources["iLableAreaCellTemplate"] as DataTemplate;
  
I have assigned above datatemplate to celltemplate of Radgridview Column
  
I have written custom logic for texttrimming for the iLable control in silverlight 3, for texttrimming to happen i need the width of the parent (that is cell's width)
  
How can i achive this?

1 Answer, 1 is accepted

Sort by
0
Pavel Pavlov
Telerik team
answered on 19 Oct 2010, 09:02 AM
Hello Prakash,

If you set the HorizontalAlignment = stretch to  your StackPanel , the width of the stack panel , will be equal to the width of the containing cell.
This way you can use the width of the stack panel for your purposes.

Regards,
Pavel Pavlov
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
Prakash
Top achievements
Rank 1
Answers by
Pavel Pavlov
Telerik team
Share this question
or