Wpf “显示”;“弹出窗口”;鼠标何时在列表框项上

Wpf “显示”;“弹出窗口”;鼠标何时在列表框项上,wpf,listbox,popupwindow,ismouseover,Wpf,Listbox,Popupwindow,Ismouseover,我将可观察集合绑定到listBox上。我有listbox项上的数据tempate。它由一个图像控件和som文本块组成 如果将鼠标放在某个列表框项目上,我希望实现以下行为: 显示弹出窗口/工具提示(一些带有控件的“矩形”)并绑定列表框当前项中的值 在项目数据模板的文本框中,我有样式,我想改变文本块中文本的颜色,例如从黑色变为绿色 风格如下: <Style x:Key="FriedNickStyle" TargetType="TextBlock">

我将可观察集合绑定到listBox上。我有listbox项上的数据tempate。它由一个图像控件和som文本块组成

如果将鼠标放在某个列表框项目上,我希望实现以下行为:

  • 显示弹出窗口/工具提示(一些带有控件的“矩形”)并绑定列表框当前项中的值
  • 在项目数据模板的文本框中,我有样式,我想改变文本块中文本的颜色,例如从黑色变为绿色
风格如下:

        <Style x:Key="FriedNickStyle" TargetType="TextBlock">
            <Setter Property="Margin" Value="2,2,2,2"/>
            <Setter Property="FontSize" Value="13"/>
            <Setter Property="FontWeight" Value="Medium"/>
            <Setter Property="Foreground" Value="Black"/>
        </Style>

对不起,对于我的英语,我无法正确描述这种行为。我尝试了很多东西,但都不管用

这是我的风格:

     <DataTemplate x:Key="FriendListBoxItemTemplate">
                <Grid Name="RootLayout">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="0.3*"></ColumnDefinition>
                        <ColumnDefinition Width="*"></ColumnDefinition>
                    </Grid.ColumnDefinitions>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="60"></RowDefinition>
                    </Grid.RowDefinitions>
                    <Image Margin="4,4,4,2" Grid.Column="0">
                        <Image.Source >
                            <MultiBinding Converter="{StaticResource avatarConverter}">
                                <Binding Path="ProfilePhoto"></Binding>
                                <Binding Path="StatusInfo.IsLogged"></Binding>
                            </MultiBinding>
                        </Image.Source>
                    </Image>
                    <Grid  Grid.Column="1">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="*"></ColumnDefinition>
                        </Grid.ColumnDefinitions>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="*"></RowDefinition>
                        </Grid.RowDefinitions>
                    <TextBlock 
                                       Text="{Binding Path=Nick}" 
                                       Style="{StaticResource FriedNickStyle}"
                                       Grid.Column="0" Grid.Row="0">
                    </TextBlock>
                    </Grid>
                </Grid>
                <DataTemplate.Triggers>
                    <Trigger Property="IsMouseOver" Value="True">
                        <!--SHOW SOME POP UP WINDOW and bind properties from ITEM (VALUE)-->
<!--Change color of textBlock-->
                    </Trigger>
                </DataTemplate.Triggers>
            </DataTemplate>

谢谢所有帮助我的人。

好吧,我找到了这个,还有另一个。 基本上是这样的:

<Popup Margin="10,10,0,13"
    Name="Popup1"
    HorizontalAlignment="Left"
    VerticalAlignment="Top"
    Width="194"
    Height="200"
    IsOpen="True">                      // change this to open it

   <TextBlock Name="McTextBlock" Background="LightBlue" >
        This is popup text
   </TextBlock>
//更改此选项以打开它
这是弹出文本

对不起,最后我承认,它是有效的,但如果它是一个好的解决方案,我就不这样做了。@user572844:不客气。每个人都问了一个愚蠢的问题;)