C# 使用<;边界角半径=“;10“/&燃气轮机;用于列表框中的文本块
我有一个绑定到数据的列表框,列表框中的每个项目我都希望有圆角。我用了一个边界标记,但它似乎没有任何效果 这是我正在使用的代码C# 使用<;边界角半径=“;10“/&燃气轮机;用于列表框中的文本块,c#,xaml,windows-phone-7,C#,Xaml,Windows Phone 7,我有一个绑定到数据的列表框,列表框中的每个项目我都希望有圆角。我用了一个边界标记,但它似乎没有任何效果 这是我正在使用的代码 <ListBox Name="lstbMenu" Margin="0,190,6,6" Height="488"> <ListBox.ItemTemplate> <DataTemplate> <Border Corn
<ListBox Name="lstbMenu" Margin="0,190,6,6" Height="488">
<ListBox.ItemTemplate>
<DataTemplate>
<Border CornerRadius="10">
<StackPanel Orientation="Horizontal" Margin="10" Background="Beige" Width="488">
<StackPanel Orientation="Vertical">
<Image Source="Images/1_0_1_1B59_7DA_2_11A0000_0_0_0.png" VerticalAlignment="Center" Height="80" Width="80" Margin="10"/>
</StackPanel>
<TextBlock Text="{Binding Path=menuText}" VerticalAlignment="Center" Margin="10" FontSize="20" />
<TextBlock Text="{Binding Path=menuPage}" Visibility="Collapsed" />
</StackPanel>
</Border>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
有人知道我的想法吗
谢谢默认情况下,
边框
背景透明,边框厚度为0。您需要设置边框的背景
、边框笔刷
和边框厚度
属性。默认情况下,边框
具有透明背景,边框厚度为0。您需要设置边框的背景
、边框笔刷
和边框厚度
属性这是您的代码,边框厚度设置为4,笔刷设置为白色,通过设置背景属性,您可以选择颜色或添加图像:
<ListBox Name="lstbMenu" Margin="0,190,6,6" Height="488">
<ListBox.ItemTemplate>
<DataTemplate>
<Border BorderThickness="4" BorderBrush="White" CornerRadius="10">
<StackPanel Orientation="Horizontal" Margin="10" Background="Beige" Width="488">
<StackPanel Orientation="Vertical">
<Image Source="Images/1_0_1_1B59_7DA_2_11A0000_0_0_0.png" VerticalAlignment="Center" Height="80" Width="80" Margin="10"/>
</StackPanel>
<TextBlock Text="{Binding Path=menuText}" VerticalAlignment="Center" Margin="10" FontSize="20" />
<TextBlock Text="{Binding Path=menuPage}" Visibility="Collapsed" />
</StackPanel>
</Border>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
这是下面的代码,边框的厚度设置为4,画笔设置为白色,通过设置背景属性,您可以选择颜色或添加图像:
<ListBox Name="lstbMenu" Margin="0,190,6,6" Height="488">
<ListBox.ItemTemplate>
<DataTemplate>
<Border BorderThickness="4" BorderBrush="White" CornerRadius="10">
<StackPanel Orientation="Horizontal" Margin="10" Background="Beige" Width="488">
<StackPanel Orientation="Vertical">
<Image Source="Images/1_0_1_1B59_7DA_2_11A0000_0_0_0.png" VerticalAlignment="Center" Height="80" Width="80" Margin="10"/>
</StackPanel>
<TextBlock Text="{Binding Path=menuText}" VerticalAlignment="Center" Margin="10" FontSize="20" />
<TextBlock Text="{Binding Path=menuPage}" Visibility="Collapsed" />
</StackPanel>
</Border>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
尝试设置边框的边框刷
和边框厚度
属性
尝试设置边框刷
和边框厚度
属性