Hi,
Below is my xaml for a field. The text wrapping works fine when the IsExpandable = False, it does not work when IsExpandable = True.
Any ideas as to what I may be missing?
<igDP:Field Name="Message" Width="100" IsExpandable="True" >
<igDP:Field.Settings>
<igDP:FieldSettings AllowEdit="False">
<igDP:FieldSettings.EditorStyle>
<Style TargetType="{x:Type igEditors:XamTextEditor}">
<Setter Property="TextWrapping" Value="Wrap" />
</igDP:FieldSettings.EditorStyle>
</igDP:FieldSettings>
</igDP:Field.Settings>
</igDP:Field>
Hello Troy,
Thank you for your post. I have been looking into it and I can say that when you set the Field’s IsExpandable to true, there won’t be any CellValuePresenter and Editor for this Field. This is why your Style id not applied. If you want to have text wrapping when a Field is expandable you have to create a Style for the ExpandableFieldRecordPresenter and add an EventSetter for the Loaded event. Then in the handler you can get the TextBlock that is used and set its Width and TextWrapping properties. I created a sample project for you showing this approach. Please let me know if this helps you or you have further questions on this matter.
Looking forward for your reply.
Thanks Stefan! That did the job perfectly. Thanks so much!
I have one follow up question for something related to this that I gave up on but you may be able to provice a quick response...
I was trying to also have the xamDataGrid such that the user could insert new rows. I'm using the AllowAddNew property but during runtime I can not add (or see for that matter) the Message field which is the one marked as IsExpandable = 'True', not sure why. Can you see anything in my xaml that I'm missing? Is this even possible given that I'm using IsExpandable = 'True'?
<igDP:XamDataGrid Name="xamDataGrid1" Margin="3,3,3,3" VerticalAlignment="Top" Height="Auto" Width="Auto" Grid.Row="1"
Theme="Office2k7Silver" DataSource="{Binding}" IsEnabled="True" IsGroupByAreaExpanded="False" GroupByAreaLocation="None"
DataContext="{Binding}" PreviewMouseDown="xamDataGrid1_PreviewMouseDown" Background="Transparent">
<igDP:XamDataGrid.FieldLayoutSettings>
<igDP:FieldLayoutSettings AllowAddNew="True" AutoGenerateFields="False" AllowDelete="True" HighlightAlternateRecords="True" />
<!--AddNewRecordLocation="Default"-->
</igDP:XamDataGrid.FieldLayoutSettings>
<igDP:XamDataGrid.FieldSettings>
<igDP:FieldSettings AllowEdit="True" CellClickAction="Default" Width="Auto" AllowResize="False" />
</igDP:XamDataGrid.FieldSettings>
<igDP:XamDataGrid.FieldLayouts>
<igDP:FieldLayout>
<igDP:Field Name="MessageAdhocMessageTemplatesID" Visibility="Collapsed"/>
<igDP:Field Name="DepartmentID" Visibility="Collapsed"/>
<igDP:Field Name="EmployeeID" Visibility="Collapsed"/>
<igDP:Field Name="TemplateName" Label="Message Templates" Width="400" Visibility="Visible" ToolTip="Double click to select the message template you want to use.">
<!--<igDP:Field.Settings>
<igDP:FieldSettings>
<Setter Property="" Value="Wrap" />
</Style>
</igDP:Field.Settings>-->
<igDP:Field Name="Message" Width="400" IsExpandable="True" >
<igDP:FieldSettings AllowEdit="True">
<igDP:FieldSettings.ExpandableFieldRecordPresenterStyle>
<Style TargetType="{x:Type igDP:ExpandableFieldRecordPresenter}">
<EventSetter Event="Loaded" Handler="ExpandableFieldRecordPresenter_Loaded"/>
</igDP:FieldSettings.ExpandableFieldRecordPresenterStyle>
<!--<igDP:FieldSettings.EditorStyle>
</igDP:FieldSettings.EditorStyle>-->
</igDP:FieldLayout>
</igDP:XamDataGrid.FieldLayouts>
</igDP:XamDataGrid>
Troy