2016-06-13 5 views
0

ラジオボタンが正しく表示されています(下の画像を参照)。 これをクリックすると、その周りに赤い四角形が表示されます(下の2番目の画像を参照)。 これはwpfでレンダリングの問題を思い起こさせていました。私は前にwinformsと同じように見えました。Wpfでクリックすると、ラジオボタンコントロールの周りに赤い四角形が表示されます

正しい行動: enter image description here

エラー動作の画像:私は、C#、mvvmlightでWPFを使用している開発用として enter image description here

。上記の問題について

<RadioButton GroupName="Part_GrpPlayBtn" 
            ToolTip="Play" 
            Style="{StaticResource StyleRadioButton}" 
            Template="{StaticResource Template_Play}" 
            IsChecked="{Binding PlayState, Converter={StaticResource PlayStateToCheckedConvert}, ConverterParameter={x:Static local:ePlaybackState.ePlay}}" > 
          <i:Interaction.Triggers> 
           <i:EventTrigger EventName="Checked" > 
            <i:InvokeCommandAction Command="{Binding PlayCommand, 
                       RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type local:VMSPlayBarControl}}}" > 

            </i:InvokeCommandAction> 
           </i:EventTrigger> 
          </i:Interaction.Triggers> 
         </RadioButton> 

<Style TargetType="RadioButton" x:Key="StyleRadioButton" > 
    <Setter Property="Margin" Value="5" /> 
    <Setter Property="ToolTipService.IsEnabled" Value="{Binding IsChecked, RelativeSource={RelativeSource Self}}"/> 
</Style> 

<ControlTemplate x:Key="Template_Play" TargetType="{x:Type RadioButton}"> 
    <Grid> 
     <Ellipse x:Name="Part_BgEllipse" Style="{StaticResource StyleEllipse}" /> 
     <Image x:Name="PART_Image" Source="{StaticResource ImgPlayOff}" Style="{StaticResource StyleImage}"/> 
     <ContentPresenter/> 
    </Grid> 
    <ControlTemplate.Triggers> 
     <Trigger Property="IsMouseOver" Value="True"> 
      <Setter TargetName="Part_BgEllipse" Property="Fill" Value="{StaticResource PrimaryBlueColorBrush}" /> 
     </Trigger> 
     <Trigger Property="IsChecked" Value="True"> 
      <Setter TargetName="PART_Image" Property="Source" Value="{StaticResource ImgPlayHover}"/> 
      <Setter TargetName="Part_BgEllipse" Property="Fill" Value="{StaticResource SecondaryLightGrayColorBrush}" /> 
     </Trigger> 
    </ControlTemplate.Triggers> 
</ControlTemplate> 

任意の提案やアイデア:

はまたIVは、以下の私のコードが含まれて?

ありがとうございました。

答えて

1

バインディングの問題が原因です。 あなたのコンバーターのConvertBack関数で、ラジオボタンのIsCheckedプロパティをViewModelプロパティにバインドしています。あなたのコンバーターコードも投稿してください。

とにかくこれを試して、動作するかどうかを確認してください。

public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) 
{ 
    return Binding.DoNothing; 
} 
+1

提案が問題を解決したようです。私はあなた自身が述べたように、Binding.DoNothingを返す代わりに、値のパラメータを返すようです。ありがとう。 – Dave23Rave

関連する問題