I set the FlowDirection of datagrid but to no use. If FlowDirection of DataGrid is set, should it be automatically set to all underlying controls. Currently the GroupByRecord header is showing data incorrectly due to its incorrect FlowDirection. Any ideas how can I make it correct.
I did this in dataGrid_InitializeRecord but didn't work. Any ideas?
if
(e.Record is GroupByRecord)
{
Style style = new Style(typeof(HeaderLabelArea), Infragistics.Windows.Themes.DataPresenterGeneric.HeaderLabelArea);
Setter setter = new Setter();
setter.Property =
FrameworkElement.FlowDirectionProperty;
setter.Value =
CultureInfo.CurrentUICulture.TextInfo.IsRightToLeft
?
FlowDirection.RightToLeft
:
FlowDirection.LeftToRight;
GroupByRecord gbr = e.Record as GroupByRecord;
Thanks,
Imad.
gbr.FieldLayout.Settings.HeaderLabelAreaStyle = style;
}
style.Setters.Add(setter);
Hello Imad,
Could you please provide me with a screenshot of the arrangement of the data in the GroupByRecord that you are expecting.
Thanks in advance.
Thank you for your reply.
It was the in my first post. Here it is agian.
I am just checking have you been able to resolve your issue? If you still need any assistance on the matter do not hesitate to ask.
Thank you for your response. I know that WPF renders controls this way and we need to set FlowDirection to resolve this. But I don't know which style should I work with to set FlowDirection. I tried this but didn't work:
if(e.Record is GroupByRecord){ Style style = new Style(typeof(HeaderLabelArea), Infragistics.Windows.Themes.DataPresenterGeneric.HeaderLabelArea); Setter setter = new Setter(); setter.Property = FrameworkElement.FlowDirectionProperty; setter.Value = CultureInfo.CurrentUICulture.TextInfo.IsRightToLeft ? FlowDirection.RightToLeft : FlowDirection.LeftToRight;
GroupByRecord gbr = e.Record as GroupByRecord; gbr.FieldLayout.Settings.HeaderLabelAreaStyle = style;}
Your help would be highly appreciated.
I can suggest you in order to change the displayed text to handle the Grouped event of the XamDataGrid and change the Description property of the header the way you want. You can try something like:
private void xdg_Grouped(object sender, Infragistics.Windows.DataPresenter.Events.GroupedEventArgs e)
foreach (Record r in xdg.Records)
(r as GroupByRecord).Description =….
If you need any further assistance on this please feel free to ask.
Actaully changing description would br useless as the same text that is in English when displayed in Arabic the brackets of text mess up. They would get correct if the flowDirection is correctly set. As you can see from the
You can change back the FlowDirection only for the GroupedByRecords while all of the other containers in the XamDataGrid have a FlowDirection set to RightToLeft. You can achieve this functionality by setting a style for the GroupByRecordPresenter like follows:
<Style TargetType="{x:Type igDP:GroupByRecordPresenter}">
<Setter Property="FlowDirection" Value="LeftToRight"/>
<Setter Property="HorizontalContentAlignment" Value="Right"/>
</Style>
However I notice that all of the Microsoft controls, when FlowDriection is set to RightToLeft, show the default string as you described it. This is why I believe that your best option in order to change the flow is handling the grouping and set a custom string that you want to be displayed.
Please let me know, if I can help you further on the matter.
Problem is solved. Thank you for the help.