我有一个ListView
类似ListViewItems
导航栏样式的菜单选项。
我想ListViewItem
在 Win10 上的邮件应用程序中创建边框“鼓起”的效果,如图所示
当鼠标沿ListViewItem
. 这是一个很好的效果,我想复制它,但我什至很难开始着手解决这个问题。
我的列表项绑定到一个内容控件,该控件使用ControlTemplate
. 这ItemsControl
ItemTemplate
是一个DataTemplate
包含图像和包裹在按钮控件中的文本框,就像这样....(尽管我怀疑它的创建方式可能与我的问题无关)
<ContentControl Content="{Binding Path=MenuModel.AllMenuItems}"
x:Name="menuCtrl1"
Template="{StaticResource MenuListItemControlTemplate}"
VerticalAlignment="Top" />
...
<ControlTemplate x:Key="MenuListItemControlTemplate" TargetType="ContentControl">
<Border Background="Transparent" >
<ScrollViewer Margin="{StaticResource DefaultNoMargin}" HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto">
<ItemsControl ItemsSource="{TemplateBinding Content}"
ItemTemplate="{StaticResource MenuListItemDataTemplate}" />
</ScrollViewer>
</Border>
</ControlTemplate>
...
<DataTemplate x:Key="MenuListItemDataTemplate" DataType="local:SingleMenuItem">
<Button Command="{Binding MenuCommand}" Style="{StaticResource MenuButtonStyle}" >
<StackPanel Orientation="Horizontal" >
<Image Source="{Binding MenuIconSource}" Style="{StaticResource MenuItemImage}" />
<TextBox Text="{Binding DisplayText}" Style="{StaticResource MenuItemStyle}" />
</StackPanel>
</Button>
</DataTemplate>
我们将不胜感激地收到有关如何实现它甚至从哪里开始的任何提示。