Hello,
I like to configure the ProjectColumns direkt in XAML like this (without any Binding to a ViewModel):
<ig:ProjectTable.Columns> <ig:ProjectColumn Key="Id" Width="43" /> <ig:ProjectColumn Key="ConstraintType" Width="100" /> <ig:ProjectColumn Key="ConstraintDate" Width="100" /> <ig:ProjectColumn Key="IsManual" Width="58" /> <ig:ProjectColumn Key="TaskName" Width="174" /> <ig:ProjectColumn Key="ManualDuration" Width="80" /> <ig:ProjectColumn Key="ManualStart" Width="94" /> <ig:ProjectColumn Key="ManualFinish" Width="94" /> <ig:ProjectColumn Key="PredecessorsIdText" Width="102" /> <ig:ProjectColumn Key="ResourcesText" Width="124" /> </ig:ProjectTable.Columns>
Only two thinks I like to define
1) With columns are visible by default
2) the "Width" Property of each column.
In your Sample here:
http://help.infragistics.com/Help/Doc/WPF/2014.1/CLR4.0/html/xamGantt_Code_Example_Changing_xamGantt_Column_Set.html
Is a reference to a ViewModel that I dont need:
<local:ProjectTableCollection>
I was not able to define the list of columns in xaml, for the xamGantt, without the local ProjecttableCollection
Hi Michael,
After consulting with our development team on this matter you could try to use as ArrayList instead of ProjecttableCollection like e.g.:
<ig:ListBackedProjectViewProvider.ViewItemsSource>
<!-- Defining the Project View -->
<coll:ArrayList>
<ig:ProjectView Key="GanttChart" TableKey="Basic" />
</coll:ArrayList>
</ig:ListBackedProjectViewProvider.ViewItemsSource>
Let me know, if you need any further assistance on this matter.
Dear Yanko,
thank you for your Support, with your tips I was able to define the default visible columns and default width direct in XAML.
Best Regards
Michael Maier
Here the code for the rest of the community:
<UserControl xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity" xmlns:coll="clr-namespace:System.Collections;assembly=mscorlib" xmlns:ig="http://schemas.infragistics.com/xaml" xmlns:gala="clr-namespace:GalaSoft.MvvmLight.Command;assembly=GalaSoft.MvvmLight.Extras.WPF4" mc:Ignorable="d" d:DesignHeight="500" d:DesignWidth="700">
<ig:ListBackedProject x:Name="dataProvider" TaskItemsSource="{Binding SchduleAppointmentXamGanttTasks}" > <ig:ListBackedProject.TaskPropertyMappings> <ig:ProjectTaskPropertyMappingCollection UseDefaultMappings="True"> <ig:ProjectTaskPropertyMapping TaskProperty="DataItemId" DataObjectProperty="TaskID" /> <ig:ProjectTaskPropertyMapping TaskProperty="ConstraintDate" DataObjectProperty="ConstraintDate" /> <ig:ProjectTaskPropertyMapping TaskProperty="ConstraintType" DataObjectProperty="ConstraintType" /> <ig:ProjectTaskPropertyMapping TaskProperty="DurationFormat" DataObjectProperty="DurationFormat" /> <ig:ProjectTaskPropertyMapping TaskProperty="Tasks" DataObjectProperty="Tasks" /> <ig:ProjectTaskPropertyMapping TaskProperty="Notes" DataObjectProperty="Notes" /> <ig:ProjectTaskPropertyMapping TaskProperty="DataItemId" DataObjectProperty="DataItemId" /> <ig:ProjectTaskPropertyMapping TaskProperty="IsManual" DataObjectProperty="IsManual" /> <ig:ProjectTaskPropertyMapping TaskProperty="Start" DataObjectProperty="Start" /> <ig:ProjectTaskPropertyMapping TaskProperty="Duration" DataObjectProperty="Duration" /> </ig:ProjectTaskPropertyMappingCollection> </ig:ListBackedProject.TaskPropertyMappings> <ig:ListBackedProject.TaskSettings> <ig:ProjectTaskSettings AllowChangeIndentation="False" AllowDelete="False" AllowDragDeadline="False" AllowDragMilestone="False" AllowDragPercentComplete="False" AllowDragSummary="Never" AllowDragTask="False" AllowInsert="False" AllowResizeSummary="Always" AllowResizeTask="False"/> </ig:ListBackedProject.TaskSettings> </ig:ListBackedProject> <ig:XamGantt x:Name="xamGantt" Focusable="True" Project="{Binding ElementName=dataProvider}" > <i:Interaction.Triggers> <i:EventTrigger EventName="MouseDoubleClick"> <gala:EventToCommand Command="{Binding OpenTaskCommand}" CommandParameter="{Binding ElementName=xamGantt, Path=ActiveRow.Task}" /> </i:EventTrigger> </i:Interaction.Triggers> <ig:XamGantt.ViewSettings> <ig:ProjectViewSettings AreSummaryTasksVisible="False" Timescale="{Binding Timescale}" /> </ig:XamGantt.ViewSettings> <ig:XamGantt.DefaultColumnSettings> <ig:ProjectColumnSettings AllowHide="True" AllowMove="True" AllowResize="True" AllowShow="True" IsReadOnly="True" /> </ig:XamGantt.DefaultColumnSettings> <ig:XamGantt.ViewProvider> <ig:ListBackedProjectViewProvider> <ig:ListBackedProjectViewProvider.ViewItemsSource> <!-- Defining the Project View --> <coll:ArrayList> <ig:ProjectView Key="GanttChart" TableKey="Basic" /> </coll:ArrayList> </ig:ListBackedProjectViewProvider.ViewItemsSource> <ig:ListBackedProjectViewProvider.TableItemsSource> <coll:ArrayList> <!-- Defining the Project Table--> <ig:ProjectTable Key="Basic"> <ig:ProjectTable.Columns> <!-- Setting the columns--> <!--<ig:ProjectColumn Key="Id" Width="43" />--> <!--<ig:ProjectColumn Key="ConstraintType" Width="100" />--> <!--<ig:ProjectColumn Key="ConstraintDate" Width="100" />--> <!--<ig:ProjectColumn Key="IsManual" Width="58" />--> <ig:ProjectColumn Key="TaskName" HeaderText="Titel" Width="*" /> <ig:ProjectColumn Key="IsCritical" HeaderText="Kritisch" Width="58" /> <!--<ig:ProjectColumn Key="ManualDuration" Width="80" /> </ig:ProjectTable.Columns> </ig:ProjectTable> </coll:ArrayList> </ig:ListBackedProjectViewProvider.TableItemsSource> </ig:ListBackedProjectViewProvider> </ig:XamGantt.ViewProvider> </ig:XamGantt>
</UserControl>
Thank you for your reply. I am glad that you have managed to resolve your issue.