<Style TargetType="{x:Type ListBox}"> <!-- 定义ListBox自身外观, 比如: 圆角边框--> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="ListBox"> <Border CornerRadius="5" Background="pink"> <ScrollViewer HorizontalScrollBarVisibility="Hidden"> <ItemsPresenter/> </ScrollViewer> </Border> </ControlTemplate> </Setter.Value> </Setter> </Style> <ListBox Height="50" HorizontalAlignment="Left" Margin="236,84,0,0" Name="listBox1" VerticalAlignment="Top" Width="120" > <ListBoxItem>wendyOne</ListBoxItem> <ListBoxItem Foreground="White">wendyTwo</ListBoxItem> <ListBoxItem>wendThree</ListBoxItem> </ListBox>
wpf中有圆角的listbox
最新推荐文章于 2022-09-14 09:34:55 发布