2011-10-26 3 views
0

リストボックス内の各アイテムは、データにバインドされたリストボックスを持っています。私は境界タグを使用しましたが、何の効果もないようです。リストボックス内のテキストブロックに<border cornerradius = "10" />を使用する

ここに私が使用しているコードがあります。

<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

'を設定してみてくださいBorderBrush'と 'BorderThickness'プロパティは、 – Praetorian

答えて

3

BorderはあなたがBorderBackgroundBorderBrushBorderThicknessプロパティを設定する必要が透明な背景と0の境界線の厚さを有しています。

0

これはbackgroundプロパティを設定することによって、あなたは色を選択するか、同様の画像を追加することができ、国境の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> 
関連する問題