나는 ListBox를 가지고있다. 흰색 배경입니다. 어떻게 제거 할 수 있습니까?Silverlight : 목록 상자의 배경을 투명하게 만드시겠습니까?
여기 제가 시도하는 XAML입니다. 내가 무엇을하더라도, 나는 그 배경을 없앨 수 없다. (나는 그것이 ListBox
의 모든 공간을 차지하는 일이 각 항목에, 또는 경우에 확실하지 않다가 ListBox
자체의 배경에 있다면.) 나는 실버 라이트 4 사용하고
<ListBox x:Name="topThreeHits" ItemsSource="{Binding TopThreeHits}" Margin="0,10,0,0">
<ListBox.ItemContainerStyle>
<Style TargetType="ListBoxItem">
<Setter Property="Background" Value="Transparent" />
</Style>
</ListBox.ItemContainerStyle>
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel Orientation="Horizontal" Background="Transparent"/>
</ItemsPanelTemplate>
</ListBox.ItemsPanel>
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel Margin="10,0" Background="Transparent">
<Image Source="{Binding Image, FallbackValue=/PlumPudding;component/Images/file.png}" />
<TextBlock>
<Run Text="{Binding Name, FallbackValue='File Name'}" FontWeight="Bold" />
<Run Text="." Foreground="#787878" FontWeight="Light" />
<Run Text="{Binding TypeExtension, FallbackValue='type'}" Foreground="#787878" FontWeight="Light" />
</TextBlock>
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
.
사실 내가 원하는 것은 배경을 제거하는 것입니다. 롤오버를 유지하고 싶었습니다. 위 코드에 게시 한 코드를 추가했는데 이제 데이터 바인딩이 작동하지 않습니다. 기본 폴백 값으로 채워집니다. 왜 그런지 모르겠습니다. –
좋아요, 이것은 제가 listboxitem의 모든 속성을 retemplating하지 않고 정확히하고 싶은 일입니다. 훨씬 더 간단합니다. –