The MouseMove Event does not gets fired on mouseover at TextBlocks in wpf ListBox

242 views Asked by At
   <ListBox x:Name="My_ListBox"
        AlternationCount="2"
  <ListBox.ItemTemplate>
    <DataTemplate>
      <Grid>
        <Grid.ColumnDefinitions>
          <ColumnDefinition Width="160" />
          <ColumnDefinition Width="110"/>
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
          <RowDefinition MinHeight="28" />
        </Grid.RowDefinitions>

        <TextBlock x:Name="lblname"
         Grid.Row="0"
         Grid.Column="0"
         FontSize="14"
         Text="{Binding Label_Name}"
         MouseMove="Summary_MouseMove">
          <ToolTipService.ToolTip >
            <ToolTip>
              <TextBlock Visibility="Collapsed" x:Name="ToolTip">
                <Run Text="{Binding Label_Name}"/>
              </TextBlock>
            </ToolTip>
          </ToolTipService.ToolTip>
        </TextBlock>
        <TextBlock x:Name="lbllastname"
                   Grid.Row="0"
                   Grid.Column="1"
                   Margin="5,0"
                   FontSize="14"
                   Foreground="Black"
                   Text="{Binding Label_Value}"
                   TextWrapping="Wrap" />
      </Grid>
    </DataTemplate>
  </ListBox.ItemTemplate>
  <ListBox.ItemContainerStyle>
    <Style TargetType="ListBoxItem">
      <Setter Property="IsEnabled" Value="False" />
      <Style.Triggers>
        <Trigger Property="ItemsControl.AlternationIndex" Value="0">
          <Setter Property="Control.Background" Value="White" />
        </Trigger>
        <Trigger Property="ItemsControl.AlternationIndex" Value="1">
          <Setter Property="Control.Background" Value="White" />
        </Trigger>
      </Style.Triggers>
    </Style>
  </ListBox.ItemContainerStyle>
</ListBox>

In the above ListBox, I am displaying the ListBoxItem values in TextBlocks, The MouseMove event is not getting fired, Because of which the Tool tip does not show on Mouse over at the TextBlock 'lblname'. Can we have any alternative to show tooltip for the TextBlock ? Any help will be appreciated, Thanks !

0

There are 0 answers