结合2 ListView.ItemContainerStyle(?

时间:2015-06-03 22:47:04

标签: wpf xaml

我正在使用" MahApps.Metro"我想为每个ListViewItem添加一个工具提示。但是如果我使用" ListView.ItemContainerStyle"我会遇到问题。在" .xaml"文件,我失去了地铁(颜色/效果)。我可以将它们结合起来吗?

<ListView
...
...
...
    <ListView.ItemContainerStyle>
        <Style TargetType="ListViewItem">
            <Setter Property="ToolTip">
                <Setter.Value>
                    <ToolTip>
                        ...
                        ...
                        ...
                    </ToolTip>
                </Setter.Value>
            </Setter>
        </Style>
    </ListView.ItemContainerStyle>
</ListView>

THX !!!

1 个答案:

答案 0 :(得分:0)

非常简单。这是合乎逻辑的部分。您只需在项目中使用Border,并在此处使用工具提示服务。 (ToolTipService.ToolTip =“我是ItemToolTIP”)

对于Exp:

<DataTemplate>
                        <Border ToolTipService.ToolTip="I am ItemToolTIP">
                            <StackPanel VerticalAlignment="Bottom" Background="{ThemeResource ListViewItemOverlayBackgroundThemeBrush}">
                                <TextBlock Text="{Binding Title}" Foreground="{ThemeResource ListViewItemOverlayForegroundThemeBrush}" Style="{StaticResource TitleTextBlockStyle}" Height="60" Margin="15,0,15,0"/>
                                <TextBlock Text="{Binding Subtitle}" Foreground="{ThemeResource ListViewItemOverlaySecondaryForegroundThemeBrush}" Style="{StaticResource CaptionTextBlockStyle}" TextWrapping="NoWrap" Margin="15,0,15,10"/>
                            </StackPanel>
                        </Border>
                    </DataTemplate>
相关问题