我簡化了我的問題與示例應用程序。所以我有一個用矩形表示一些對象的列表。在Windows 8的控制中刪除MouseOver狀態
但是我的問題是,如果我的應用程序打開Windows 8.當我將鼠標放在元素上時,我的矩形周圍會出現一個藍色的矩形。我嘗試了一些在互聯網上找到的解決方案,但都沒有工作。
我的代碼:
<Window x:Class="Test_application.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:Test_application"
Title="MainWindow" Height="350" Width="525">
<Grid Background="DarkGray">
<ListBox Margin="10" x:Name="lbTest">
<ListBox.Resources>
<DataTemplate DataType="{x:Type local:Segment}">
<Rectangle Width="150" Height="10" Stroke="Gray" StrokeThickness="1.354" Margin="10"/>
</DataTemplate>
</ListBox.Resources>
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
<Canvas />
</ItemsPanelTemplate>
</ListBox.ItemsPanel>
<ListBox.ItemContainerStyle>
<Style TargetType="{x:Type ListBoxItem}">
<Setter Property="Canvas.Left" Value="{Binding X}"/>
<Setter Property="Canvas.Top" Value="{Binding Y}"/>
<Setter Property="Margin" Value="0" />
<Setter Property="Focusable" Value="False" />
<Setter Property="Padding" Value="0" />
<Setter Property="VerticalContentAlignment" Value="Stretch"/>
<Setter Property="HorizontalContentAlignment" Value="Stretch"/>
<Setter Property="Background" Value="{x:Null}" />
</Style>
</ListBox.ItemContainerStyle>
</ListBox>
</Grid>
天啊!是工作!! :) 我已經搜索今天的每一次,你找到解決方案。 謝謝。 –