I'm new to WPF and have to make some changes to an existing application. I have a grid in a listview that you can add a note to each row of if required. I've done this and added a notes icon that displays a tooltip with the last 5 notes when you hover over it. If I display a lot of notes when hovering over a vertical scrollbar is displayed, however I can't use that scrollbar because as soon as I move off the notes icon the tooltip disappears.
Is there a way to have the tooltip remain so that I can scroll through all the notes?
Failing that could I implement a history popup? Users would right click the row, select 'note history' and then get a popup window with all the notes in it with the ability to scroll if necessary. Does anyone have an example of something similar if the tooltip option is not possible?
Here is my code
<ToolTip x:Key="CustomerNotesTT" Background="{DynamicResource Brush_ToolTipBackground}" MaxWidth="400"><Grid><Grid.RowDefinitions><RowDefinition Height="Auto"></RowDefinition><RowDefinition></RowDefinition></Grid.RowDefinitions><TextBlock FontWeight="Bold" TextDecorations="UnderLine" Text="Notes" /><ListView BorderThickness="0" Background="Transparent" Grid.Row="1" ItemsSource="{Binding Path=customerNotes}" Margin="0,3,0,0" ItemContainerStyle="{DynamicResource ListViewItemTT}" ><ListView.View><GridView ColumnHeaderContainerStyle="{StaticResource GridViewHeaderTT}"><GridViewColumn Width="250" Header="Description"><GridViewColumn.CellTemplate><DataTemplate><TextBlock TextWrapping="Wrap" Text="{Binding Path=Description}" /></DataTemplate></GridViewColumn.CellTemplate></GridViewColumn><GridViewColumn Header="Date" DisplayMemberBinding="{Binding Path=DateEntered, StringFormat='{}{0:dd/MM/yyyy}'}" /></GridView></ListView.View></ListView></Grid></ToolTip><DataTemplate x:Key="CustomerNotesToolTip"><StackPanel><Image Name="notesImage" Height="16" Width="16" Source="/AppLibrary.Focus;component/Views/Images/document.png" Visibility="Hidden" /> </StackPanel><DataTemplate.Triggers><DataTrigger Binding="{Binding HasNotes}" Value="True"><Setter TargetName="notesImage" Property="Visibility" Value="Visible" /><Setter TargetName="notesImage" Property="ToolTip" Value="{StaticResource CustomerNotesTT}" /><Setter TargetName="notesImage" Property="ToolTipService.ShowDuration" Value="1000000" /></DataTrigger></DataTemplate.Triggers></DataTemplate>
<ListView ItemContainerStyle="{DynamicResource HeaderedListViewItem}" Style="{StaticResource HeaderedListView}" Margin="3" BorderThickness="0" AlternationCount="2" Name="lvAllSummary" MaxHeight="{Binding ElementName=borderAllSummary, Path=ActualHeight}" ItemsSource="{Binding Clients}" MouseDoubleClick="lvAllSummary_MouseDoubleClick" SelectionMode="Single" ScrollViewer.ScrollChanged="lvAllSummary_ScrollChanged" ><ListView.ContextMenu><ContextMenu><MenuItem Header="Add Notes" Foreground="Black" Command="{Binding Path=UpdateCustomerNotesDialogCommand}" CommandParameter="{Binding Path=PlacementTarget.SelectedItems, RelativeSource={RelativeSource AncestorType={x:Type ContextMenu}}}" /></ContextMenu></ListView.ContextMenu><ListView.View><GridView AllowsColumnReorder="True"><GridViewColumn Width="80" DisplayMemberBinding="{Binding Path=Code}"><GridViewColumnHeader Command="{Binding SortListCommand}" CommandParameter="Code">Code</GridViewColumnHeader></GridViewColumn><GridViewColumn Width="320" DisplayMemberBinding="{Binding Path=AccountName}"><GridViewColumnHeader Command="{Binding SortListCommand}" CommandParameter="AccountName">Name</GridViewColumnHeader></GridViewColumn><GridViewColumn Width="100" DisplayMemberBinding="{Binding Path=TotalOwed, StringFormat='{}{0:C}'}"><GridViewColumnHeader Command="{Binding SortListCommand}" CommandParameter="TotalOwed">TotalOwed</GridViewColumnHeader></GridViewColumn><GridViewColumn Width="100" DisplayMemberBinding="{Binding Path=Credits, StringFormat='{}{0:C}'}"><GridViewColumnHeader Command="{Binding SortListCommand}" CommandParameter="Credits">Credits</GridViewColumnHeader></GridViewColumn><GridViewColumn CellTemplate="{StaticResource CustomerNotesToolTip}"></GridViewColumn></GridView></ListView.View> </ListView>