일부 이미지가있는 ListBox
이 있습니다. 선택한 색상을 약간 강조 표시하고 싶습니다. ScrollViewer
으로 이미지를 가로로 표시하려면 WwrapPanel
을 사용하고 있습니다. 내 문제를 해결할 방법이 있습니까?목록 상자에서 선택한 항목을 일부 색상으로 강조 표시해야합니다.
0
A
답변
1
당신은에 isSelected 속성에 트리거가있는 ItemContainerStyle을 사용해야하며, 트리거에 당신이 트릭해야
+0
입니다. 그 코드를 게시 할 수 있습니다. –
+0
답장을 보내 주셔서 감사합니다. 나는 ur 도움으로 해결책을 얻었다. –
+0
답변을 수락 된 것으로 표시하는 것을 잊지 마세요. –
1
Background 속성에 세터를 넣어 :
<Window x:Class="StackOverflowTests.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Window1" x:Name="window1" Height="300" Width="300">
<Window.Resources>
<!-- Specifies the Selection style of ListBoxItems. This changes the forced underlay colors from gray to transparent. -->
<Style TargetType="ListBoxItem">
<Style.Resources>
<!-- This is the color used if the item is selected and the listbox has focus -->
<SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" Color="Red"/>
</Style.Resources>
</Style>
</Window.Resources>
<Grid>
<StackPanel Orientation="Vertical">
<ListBox>
<ListBoxItem Content="Item 1" />
<ListBoxItem Content="Item 2" />
<ListBoxItem Content="Item 3" />
<ListBoxItem Content="Item 4" />
<ListBoxItem Content="Item 5" />
<ListBoxItem Content="Item 6" />
<ListBoxItem Content="Item 7" />
<ListBoxItem Content="Item 8" />
<ListBoxItem Content="Item 9" />
<ListBoxItem Content="Item 10" />
</ListBox>
</StackPanel>
</Grid>
</Window>
어쩌면 맞춤법을 검사 할을 이 질문에 대한 문법은 – Vidar