2016-11-09 21 views
0

單選按鈕,當我點擊手動單選按鈕RadioButton在未聚焦時有白色背景?

單選按鈕,當我按下另一個按鈕來設置選擇

似乎是當單選按鈕不集中,然後得到這個白色方盒各地

造型爲RB:

      <TextBlock Margin="0,0,0,0" Foreground="#FF3E3E3E" FontFamily="Calibri" FontSize="12"> 
           <ContentPresenter /> 
          </TextBlock> 
         </BulletDecorator> 

         <ControlTemplate.Triggers> 
          <Trigger Property="IsChecked" Value="true"> 
           <Setter TargetName="RadioMark" Property="Visibility" Value="Visible"/> 
           <Setter TargetName="RadioOuter" Property="BorderBrush" Value="Yellow" /> 
          </Trigger> 
         </ControlTemplate.Triggers> 
        </ControlTemplate> 
       </Setter.Value> 
      </Setter> 
     </Style> 

列表框:

 <ListBox Background="Transparent" BorderThickness="0" ItemsSource="{Binding WhatsNewList}" SelectedItem="{Binding SelectedItem}"> 
      <ListBox.Resources> 
       <SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" Color="Transparent" /> 
       <SolidColorBrush x:Key="{x:Static SystemColors.HighlightTextBrushKey}" Color="Black" /> 
       <SolidColorBrush x:Key="{x:Static SystemColors.ControlBrushKey}" Color="Transparent" /> 
      </ListBox.Resources>      
      <ListBox.ItemsPanel> 
       <ItemsPanelTemplate> 
        <StackPanel Orientation="Horizontal" 
          VerticalAlignment="Center" 
          HorizontalAlignment="Center"> 
        </StackPanel> 
       </ItemsPanelTemplate> 
      </ListBox.ItemsPanel> 
      <ListBox.ItemTemplate> 
       <DataTemplate DataType="{x:Type local:ExampleClass}"> 
        <RadioButton GroupName="Properties" Background="Transparent"> 
         <RadioButton.IsChecked> 
          <Binding Path="IsSelected" 
          RelativeSource="{RelativeSource AncestorType=ListBoxItem}" 
          Mode="TwoWay" /> 
         </RadioButton.IsChecked> 
        </RadioButton> 
       </DataTemplate> 
      </ListBox.ItemTemplate> 
     </ListBox> 

我有一個按鈕,改變 「的SelectedItem」 編程在列表框。然而,當我點擊按鈕時,它會更新選擇,但不需要的副作用是我單選按鈕後面的白色方框。我如何刪除它?

回答

0

我發現這個問題,我需要改變InactiveSelectionHighlightBrushKey顏色爲透明

<ListBox.Resources> 
    <SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" Color="Transparent" Opacity=".4"/> 
    <SolidColorBrush x:Key="{x:Static SystemColors.InactiveSelectionHighlightBrushKey }" Color="Transparent" Opacity=".4"/> 
</ListBox.Resources>