Note that there are some explanatory texts on larger screens.

plurals
  1. POIssue templating RadioButton in Silverlight 5
    text
    copied!<p>I try to apply a really simple ControlTemplate to a RadioButton. But that cause in a weird behavior. As Long as I´m just clicking the Label everything works fine, but when I click the button control itself it never changes again. Here the complete code of the control:</p> <pre><code> &lt;UserControl x:Class="RadioButtonDemo.MainPage" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" d:DesignHeight="300" d:DesignWidth="400"&gt; &lt;UserControl.Resources&gt; &lt;ControlTemplate TargetType="RadioButton" x:Key="RadioButtonTemplate"&gt; &lt;Grid&gt; &lt;Grid.ColumnDefinitions&gt; &lt;ColumnDefinition Width="*"/&gt; &lt;ColumnDefinition Width="2*"/&gt; &lt;/Grid.ColumnDefinitions&gt; &lt;TextBlock Text="{TemplateBinding Content}"/&gt; &lt;RadioButton IsChecked="{TemplateBinding IsChecked}" Grid.Column="1" HorizontalAlignment="Left" VerticalAlignment="Center"/&gt; &lt;/Grid&gt; &lt;/ControlTemplate&gt; &lt;Style TargetType="RadioButton" x:Key="RadioButtonStyle"&gt; &lt;Setter Property="Template" Value="{StaticResource RadioButtonTemplate}"/&gt; &lt;/Style&gt; &lt;/UserControl.Resources&gt; &lt;StackPanel&gt; &lt;RadioButton Content="Textbox diabled" GroupName="Group1" Style="{StaticResource RadioButtonStyle}"/&gt; &lt;RadioButton x:Name="EnabledButton" Content="Textbox enabled" GroupName="Group1" Style="{StaticResource RadioButtonStyle}"/&gt; &lt;TextBox IsEnabled="{Binding IsChecked, ElementName=EnabledButton}"/&gt; &lt;/StackPanel&gt; </code></pre> <p></p> <p>Can someone help?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload