Hi,
is it possible to define a FieldLayout in a ResourceDictionary (own XAML and directory) ?
FieldSetting and FieldLayoutSettings work well.
Resourcedictionary.xaml
<igDP:FieldSettings x:Key="Settings1" AllowEdit="False" AllowGroupBy="False" AllowRecordFiltering="True" CellClickAction="EnterEditModeIfAllowed" />
<igDP:FieldLayoutSettings x:Key="Settings2" AllowAddNew="False" AllowDelete="False" AllowRecordFixing="Top" AutoFitMode="Always" HighlightAlternateRecords="True" />
MainWindow.xaml
<igDP:XamDataGrid x:Name="xamDataGrid" FieldLayoutSettings="{DynamicResource Settings2}" FieldSettings="{DynamicResource Settings1}" />
But how i will get a FieldLayout to work like this:
<igDP:FieldLayout x:Key="FieldLayout1"> <igDP:FieldLayout.Fields> <igDP:Field Name="name" /> <igDP:Field Name="department" /> <igDP:Field Name="salary" /> <igDP:Field Name="email" /> </igDP:FieldLayout.Fields> </igDP:FieldLayout>
Thanks in advanced.
Edit. DataSource is bind programmaticly on ClickEvent in Code behind (VB.net)
In the constructor for your view:
uxGrid.FieldLayouts.Clear();uxGrid.FieldLayouts.Add(this.Resources["LayoutResourceKey"] as FieldLayout);
Can you please give an example of defining multiple FieldLayouts as Resources and then loading them from Resources. As XamDataGrid initializes I’d like to dynamically load appropriate FieldLayout.
Thanks!
I think the OP was asking for the XAML that he needs to write in order to add a field layout defined in a resource dictionary as one of the field layouts. I know this can be done in code behind, but this kludgy and results in a poor design experience. Is there a method to accomplish this in XAML and what would that look like?
Well,
If the FieldLayout is a resource, you have to get it from the resources and apply it to the XamDataGrid - add it in the FieldLayouts collection of the XamDataGrid.
I know the DataSource. The problem is, if i define the FieldLayout directly in the DataGrid it works. Collapsed Columns are not shown etc.
Example:
<igDP:XamDataGrid x:Name="igdgridArt" Theme="Office2k7Blue">
<igDP:XamDataGrid.FieldLayouts>
<igDP:FieldLayout>
<igDP:FieldLayout.RecordFilters>
<igDP:RecordFilter FieldName="ID">
<igWindows:ComparisonCondition Operator="Equals" Value="12" />
</igDP:RecordFilter>
</igDP:FieldLayout.RecordFilters>
<igDP:Field Name="ID" Visibility="Collapsed" />
<igDP:Field Name="von" />
<igDP:Field Name="bis" >
<igDP:Field.Settings>
<igDP:FieldSettings FilterOperandUIType="DropDownList" />
</igDP:Field.Settings>
</igDP:Field>
<igDP:Field Name="R1" Visibility="Collapsed" />
<igDP:Field Name="Q1" Visibility="Collapsed" />
</igDP:FieldLayout>
</igDP:XamDataGrid.FieldLayouts>
</igDP:XamDataGrid>
If I define the same FieldLayout in a Resource dictionary with the x:Key Property the Datagrid show nothing. Where must I set the ResourceBinding in the Window and how?
Window.xaml
..
ResourceDictionary.xaml
<igDP:FieldLayout x:Key="FieldLayout1">