@@ -19,7 +19,7 @@ namespace CDP4RelationshipMatrix.ViewModels
1919 using CDP4Common . SiteDirectoryData ;
2020 using CDP4Dal ;
2121 using CDP4Dal . Operations ;
22- using DevExpress . XtraPrinting . Native ;
22+ using DevExpress . Xpf . Grid ;
2323 using NLog ;
2424 using ReactiveUI ;
2525 using Settings ;
@@ -155,6 +155,8 @@ public MatrixViewModel(ISession session, Iteration iteration, RelationshipMatrix
155155 this . ProcessAltCellCommand = ReactiveCommand . CreateAsyncTask ( x => this . ProcessAltCellCommandExecute ( ( List < object > ) x ) , RxApp . MainThreadScheduler ) ;
156156 this . ProcessAltControlCellCommand = ReactiveCommand . CreateAsyncTask ( x => this . ProcessAltControlCellCommandExecute ( ( List < object > ) x ) , RxApp . MainThreadScheduler ) ;
157157
158+ this . ToggleColumnHighlightCommand = ReactiveCommand . CreateAsyncTask ( x => this . ToggleColumnHighlightCommandExecute ( x as GridColumn ) , RxApp . MainThreadScheduler ) ;
159+
158160 this . SubscribeCommandExceptions ( ) ;
159161
160162 this . WhenAnyValue ( x => x . SelectedCell ) . Subscribe ( _ => this . ComputeCommandCanExecute ( ) ) ;
@@ -269,6 +271,11 @@ public bool IsVisibleDeleteAll
269271 /// </summary>
270272 public ReactiveCommand < Unit > ProcessAltControlCellCommand { get ; private set ; }
271273
274+ /// <summary>
275+ /// Gets the command to process column highlight toggle.
276+ /// </summary>
277+ public ReactiveCommand < Unit > ToggleColumnHighlightCommand { get ; private set ; }
278+
272279 /// <summary>
273280 /// Gets or sets the selected cell
274281 /// </summary>
@@ -489,10 +496,7 @@ private void SubscribeCommandExceptions()
489496 private IList < ColumnDefinition > CreateColumns ( IReadOnlyList < DefinedThing > source , DisplayKind displayKind , bool showRelatedOnly , IList < BinaryRelationship > relationships )
490497 {
491498 var columns = new List < ColumnDefinition > ( ) ;
492-
493- // column that contains the name of the thing to display for each row
494- columns . Add ( new ColumnDefinition ( CDP4_NAME_HEADER , ROW_NAME_COLUMN , true ) ) ;
495-
499+
496500 foreach ( var definedThing in source . DistinctBy ( x => x . ShortName ) )
497501 {
498502 if ( showRelatedOnly && ! relationships . Any ( x =>
@@ -512,6 +516,12 @@ private IList<ColumnDefinition> CreateColumns(IReadOnlyList<DefinedThing> source
512516 columns . Add ( new ColumnDefinition ( definedThing , displayKind ) ) ;
513517 }
514518
519+ if ( columns . Any ( ) )
520+ {
521+ // column that contains the name of the thing to display for each row
522+ columns . Insert ( 0 , new ColumnDefinition ( CDP4_NAME_HEADER , ROW_NAME_COLUMN , true ) ) ;
523+ }
524+
515525 return columns ;
516526 }
517527
@@ -808,6 +818,22 @@ private async Task ProcessAltControlCellCommandExecute(List<object> cellInfo)
808818 }
809819 }
810820
821+ /// <summary>
822+ /// Executes a toggle of column highlight command
823+ /// </summary>
824+ /// <param name="column">The column.</param>
825+ private async Task ToggleColumnHighlightCommandExecute ( GridColumn column )
826+ {
827+ if ( column == null )
828+ {
829+ return ;
830+ }
831+
832+ var vm = column . DataContext as ColumnDefinition ;
833+
834+ vm ? . ToggleHighlight ( ) ;
835+ }
836+
811837 /// <summary>
812838 /// Creates a <see cref="BinaryRelationship"/> for the selected cell
813839 /// </summary>
0 commit comments