@@ -19,6 +19,7 @@ namespace CDP4RelationshipMatrix.ViewModels
1919 using CDP4Common . SiteDirectoryData ;
2020 using CDP4Dal ;
2121 using CDP4Dal . Operations ;
22+ using CDP4RelationshipMatrix . DataTypes ;
2223 using DevExpress . Xpf . Grid ;
2324 using NLog ;
2425 using ReactiveUI ;
@@ -69,6 +70,11 @@ public class MatrixViewModel : ReactiveObject, IDisposable
6970 /// </summary>
7071 private string title ;
7172
73+ /// <summary>
74+ /// Backing field for <see cref="SelectedItemDetails"/>
75+ /// </summary>
76+ private string selectedItemDetails ;
77+
7278 /// <summary>
7379 /// Backing field for <see cref="SelectedCell"/>
7480 /// </summary>
@@ -154,9 +160,11 @@ public MatrixViewModel(ISession session, Iteration iteration, RelationshipMatrix
154160 this . ProcessCellCommand = ReactiveCommand . CreateAsyncTask ( x => this . ProcessCellCommandExecute ( ( List < object > ) x ) , RxApp . MainThreadScheduler ) ;
155161 this . ProcessAltCellCommand = ReactiveCommand . CreateAsyncTask ( x => this . ProcessAltCellCommandExecute ( ( List < object > ) x ) , RxApp . MainThreadScheduler ) ;
156162 this . ProcessAltControlCellCommand = ReactiveCommand . CreateAsyncTask ( x => this . ProcessAltControlCellCommandExecute ( ( List < object > ) x ) , RxApp . MainThreadScheduler ) ;
157-
158163 this . ToggleColumnHighlightCommand = ReactiveCommand . CreateAsyncTask ( x => this . ToggleColumnHighlightCommandExecute ( x as GridColumn ) , RxApp . MainThreadScheduler ) ;
159164
165+ this . MouseDownCommand = ReactiveCommand . Create ( ) ;
166+ this . MouseDownCommand . Subscribe ( x => this . MouseDownCommandExecute ( ( MatrixAddress ) x ) ) ;
167+
160168 this . SubscribeCommandExceptions ( ) ;
161169
162170 this . WhenAnyValue ( x => x . SelectedCell ) . Subscribe ( _ => this . ComputeCommandCanExecute ( ) ) ;
@@ -271,6 +279,11 @@ public bool IsVisibleDeleteAll
271279 /// </summary>
272280 public ReactiveCommand < Unit > ProcessAltControlCellCommand { get ; private set ; }
273281
282+ /// <summary>
283+ /// Gets the command to process the mousedown click.
284+ /// </summary>
285+ public ReactiveCommand < object > MouseDownCommand { get ; private set ; }
286+
274287 /// <summary>
275288 /// Gets the command to process column highlight toggle.
276289 /// </summary>
@@ -294,6 +307,15 @@ public string Title
294307 private set { this . RaiseAndSetIfChanged ( ref this . title , value ) ; }
295308 }
296309
310+ /// <summary>
311+ /// Gets or sets the string that represents the details of the selected item
312+ /// </summary>
313+ public string SelectedItemDetails
314+ {
315+ get { return this . selectedItemDetails ; }
316+ private set { this . RaiseAndSetIfChanged ( ref this . selectedItemDetails , value ) ; }
317+ }
318+
297319 /// <summary>
298320 /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
299321 /// </summary>
@@ -502,7 +524,7 @@ private IList<ColumnDefinition> CreateColumns(IReadOnlyList<DefinedThing> source
502524 if ( showRelatedOnly && ! relationships . Any ( x =>
503525 x . Source . Iid . Equals ( definedThing . Iid ) || x . Target . Iid . Equals ( definedThing . Iid ) ) )
504526 {
505- // if thing is ont in any relationships, skip
527+ // if thing is not in any relationships, skip
506528 continue ;
507529 }
508530
@@ -740,6 +762,11 @@ private void ComputeCommandCanExecute()
740762 /// <param name="cellInfo">The array of cell information.</param>
741763 private async Task ProcessCellCommandExecute ( List < object > cellInfo )
742764 {
765+ if ( cellInfo == null )
766+ {
767+ return ;
768+ }
769+
743770 // if not a relationship cell do nothing
744771 if ( cellInfo [ 1 ] == null || cellInfo [ 1 ] . Equals ( CDP4_NAME_HEADER ) )
745772 {
@@ -766,6 +793,11 @@ private async Task ProcessCellCommandExecute(List<object> cellInfo)
766793 /// <param name="cellInfo">The array of cell information.</param>
767794 private async Task ProcessAltCellCommandExecute ( List < object > cellInfo )
768795 {
796+ if ( cellInfo == null )
797+ {
798+ return ;
799+ }
800+
769801 if ( cellInfo [ 1 ] == null || cellInfo [ 1 ] . Equals ( CDP4_NAME_HEADER ) )
770802 {
771803 return ;
@@ -791,6 +823,11 @@ private async Task ProcessAltCellCommandExecute(List<object> cellInfo)
791823 /// <param name="cellInfo">The array of cell information.</param>
792824 private async Task ProcessAltControlCellCommandExecute ( List < object > cellInfo )
793825 {
826+ if ( cellInfo == null )
827+ {
828+ return ;
829+ }
830+
794831 if ( cellInfo [ 1 ] == null || cellInfo [ 1 ] . Equals ( CDP4_NAME_HEADER ) )
795832 {
796833 return ;
@@ -818,6 +855,24 @@ private async Task ProcessAltControlCellCommandExecute(List<object> cellInfo)
818855 }
819856 }
820857
858+ /// <summary>
859+ /// Executes the <see cref="ProcessColumnCommand"/>
860+ /// </summary>
861+ /// <param name="matrixAddress">
862+ /// the address of the selected column
863+ /// </param>
864+ private void MouseDownCommandExecute ( MatrixAddress matrixAddress )
865+ {
866+ if ( matrixAddress == null )
867+ {
868+ this . SelectedItemDetails = string . Empty ;
869+ return ;
870+ }
871+
872+ var columnDefinition = this . Columns . SingleOrDefault ( c => c . FieldName == matrixAddress . Column ) ;
873+ this . SelectedItemDetails = columnDefinition ? . ToolTip ;
874+ }
875+
821876 /// <summary>
822877 /// Executes a toggle of column highlight command
823878 /// </summary>
0 commit comments