I have my grid with star sized columns, and I need word wrapping on. However, if the columns are star sized, the wrapped text does not automatically expand the row's height to display all of the text. In the picture I have attached, the text in the second and fourth rows are supposed to say "Personal Representative", but the row's height is not expanded to show the text. If I put a hard-coded number for the column width, then the row expands its height to accomodate the text's wrap. Is there a way to have star-sized columns and word wrap?
That works perfectly, thank you!
Mike Kenyon said: So, we have our rows getting resized to based off of their content. If we then expand out the containing window, the grid resizes, but the rows don't resize which leaves an ungodly amount of white space surrounding the content. Is there someway to have the system re-adjust the rowheight following a resize fo the grid?
So, we have our rows getting resized to based off of their content. If we then expand out the containing window, the grid resizes, but the rows don't resize which leaves an ungodly amount of white space surrounding the content.
Is there someway to have the system re-adjust the rowheight following a resize fo the grid?
Hi,
You can set the RowHeight of the XamGrid to Dynamic.
Xaml:
... <ig:XamGrid x:Name="XGrid" RowHeight="Dynamic"> </ig:XamGrid> ...
C#
... this.XGrid.RowHeight = Infragistics.Controls.Grids.RowHeight.Dynamic; ...
Hope this helps
So, the reason your text isn't resizing, is b/c of your StackPanel.
A StackPanel, when set to the Horizontal Orientation, will tell all of its children that they have Infinite Width. Which means, that they will render with their full width. Thus it'll never wrap. If you want it to wrap, while using a StackPanel, you need to set a explicit width on your TextBlock.
<StackPanel x:Name="ComboColumn" Orientation="Horizontal">
<TextBlock Text="{Binding Tooltip}" Width="200" TextWrapping="Wrap" />
</StackPanel>
-SteveZ
This is XAML. Initially I get very wide cells and, when I resize them I don't see any wrapping until I click the cell.
<Controls:TemplateColumn Key="f_0" GroupByComparer="{StaticResource groupComparer}" >
<Controls:TemplateColumn.HeaderTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<TextBlock Text="Title 1" />
</DataTemplate>
</Controls:TemplateColumn.HeaderTemplate>
<Controls:TemplateColumn.ItemTemplate>
<TextBlock Text="{Binding f_0.Text , Mode=TwoWay}" TextWrapping="Wrap" />
<TextBlock Text="{Binding f_0.Value , Mode=TwoWay}" Visibility="Collapsed" />
</Controls:TemplateColumn.ItemTemplate>
<Controls:TemplateColumn.EditorTemplate>
<Grid x:Name="ComboColumn" >
<Grid.RowDefinitions>
<RowDefinition></RowDefinition>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition></ColumnDefinition>
</Grid.ColumnDefinitions>
<TextBlock x:Name="Text" Grid.Column="0" Grid.Row="0" Text="{Binding f_0.Text, Mode=TwoWay}" HorizontalAlignment="Left" VerticalAlignment="Center" TextWrapping="Wrap"></TextBlock>
<TextBlock x:Name="Value" Visibility="Collapsed" Text="{Binding f_0.Value, Mode=TwoWay}"></TextBlock>
<Button x:Name="btnPopup" Grid.Column="1" Grid.Row="0" HorizontalAlignment="Right" >
<Image x:Name="popupImage" />
</Button>
</Grid>
</Controls:TemplateColumn.EditorTemplate>
</Controls:TemplateColumn>