title: Binding RadioButton.IsChecked with Listbox.SelectedItem
body: <p>My View is clickable like a radiobutton with about 7 other of these radiobuttons, but my listbox is not updating it's selected property unless I click outside of my radiobutton.</p>
  
  <p>Basically I have a AbstractTask as my base. I have 7 child classes. I want to be able to select one of these AbstractTasks. That's all i'm after. So in my main window i have this.</p>
  
  <pre><code>&lt;Window x:Class="AdvancedTaskAssigner.View.MainWindowView"
          xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
          xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
          xmlns:v="clr-namespace:AdvancedTaskAssigner.View"
          Title="MainWindowView" Height="300" Width="300" SizeToContent="Height"&gt;
      &lt;DockPanel&gt;
          &lt;TextBlock Text="TextBlock" DockPanel.Dock="Top" /&gt;
          &lt;TextBlock Text="{Binding ElementName=listTasks, Path=SelectedItem.Name}" DockPanel.Dock="Top" /&gt;
  
          &lt;ListBox x:Name="listTasks" ItemsSource="{Binding Tasks}" HorizontalContentAlignment="Stretch" SelectedItem="{Binding IsSelected}"&gt;
              &lt;ListBox.ItemTemplate&gt;
                  &lt;DataTemplate&gt;
                      &lt;v:AbstractTaskView /&gt;
                  &lt;/DataTemplate&gt;
              &lt;/ListBox.ItemTemplate&gt;
  
          &lt;/ListBox&gt;
      &lt;/DockPanel&gt;
  &lt;/Window&gt;
  </code></pre>
  
  <p>since this is a library and not a application I had to put this in the Constructor of MainWindowView</p>
  
  <p><strong>MainWindowView.xaml.cs</strong></p>
  
  <pre><code>    public MainWindowView()
      {
          InitializeComponent();
          var atvm = new ViewModel.MainWindowViewModel();
          atvm.LoadTasks();
          this.DataContext = atvm;
      }
  </code></pre>
  
  <p><strong>MainWindowViewModel.cs</strong></p>
  
  <pre><code>class MainWindowViewModel
  {
      internal void LoadTasks()
      {
          var assembly = Assembly.GetAssembly(typeof(AbstractTask)).GetTypes().Where(t =&gt; t.IsSubclassOf(typeof(AbstractTask)));
          Type[] typelist = GetTypesInNamespace(Assembly.GetAssembly(typeof(AbstractTask)), typeof(AbstractTask));
          foreach (Type t in typelist)
          {
              if(!t.IsAbstract &amp;&amp; t.BaseType.Equals(typeof(AbstractTask)))
              {
                  tasks.Add(new AbstractTaskViewModel(t));
              }
  
          }
      }
      private Type[] GetTypesInNamespace(Assembly assembly, Type baseClass)
      {
          return assembly.GetTypes().Where(t =&gt; t.IsSubclassOf(baseClass)).ToArray();
      }
  
      private ObservableCollection&lt;AbstractTaskViewModel&gt; tasks = new ObservableCollection&lt;AbstractTaskViewModel&gt;();
  
      public ObservableCollection&lt;AbstractTaskViewModel&gt; Tasks
      {
          get { return tasks; }
      }
  
  }
  </code></pre>
  
  <p><strong>AbstractTaskViewModel.cs</strong></p>
  
  <pre><code>public class AbstractTaskViewModel
  {
      public AbstractTaskViewModel(Type task)
      {
          if (!task.IsSubclassOf(typeof(AbstractTask)))
          {
              throw new NotSupportedException(string.Format("{0} is not a subclass of AbstractTask", task.Name));
          }
          Task = task;
      }
  
      public string Description
      {
          get
          {
              return GetCustomAttribute(0);
          }
      }
      public string Name
      {
          get
          {
              return GetCustomAttribute(1);
          }
      }
      public bool IsSelected{get;set;}
  
      private string GetCustomAttribute(int index)
      {
          var descriptions = (DescriptionAttribute[])Task.GetCustomAttributes(typeof(DescriptionAttribute), false);
  
          if (descriptions.Length == 0)
          {
              return null;
          }
          return descriptions[index].Description;
      }
  
      protected readonly Type Task;
  }
  </code></pre>
  
  <p><strong>AbstractTaskView.xaml</strong></p>
  
  <pre><code>&lt;RadioButton 
      x:Class="AdvancedTaskAssigner.View.AbstractTaskView"
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
      xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
      mc:Ignorable="d" d:DesignHeight="300" d:DesignWidth="300" GroupName="AbstractTasks" Background="Transparent" IsChecked="{Binding IsSelected, Mode=TwoWay}"&gt;
      &lt;RadioButton.Template&gt;
          &lt;ControlTemplate TargetType="{x:Type RadioButton}"&gt;
              &lt;Grid&gt;
                  &lt;Border x:Name="MyHead" BorderBrush="Black" BorderThickness="2" CornerRadius="5" Background="LightGray" Margin="20,0,0,0" HorizontalAlignment="Left" VerticalAlignment="Top" Panel.ZIndex="2"&gt;
                      &lt;TextBlock Text="{Binding Name}" Margin="5,2" MinWidth="50" /&gt;
                  &lt;/Border&gt;
                  &lt;Border x:Name="Myoooo" BorderBrush="Black" BorderThickness="2" CornerRadius="5" Background="Transparent" Margin="0,10,0,0" Panel.ZIndex="1"&gt;
                      &lt;TextBlock Text="{Binding Description}" Margin="5,15,5,2" /&gt;
                  &lt;/Border&gt;
              &lt;/Grid&gt;
              &lt;ControlTemplate.Triggers&gt;
                  &lt;Trigger Property="IsChecked" Value="True"&gt;
                      &lt;Setter TargetName="MyHead" Property="Background" Value="LightGreen" /&gt;
                  &lt;/Trigger&gt;
  
              &lt;/ControlTemplate.Triggers&gt;
  
          &lt;/ControlTemplate&gt;
      &lt;/RadioButton.Template&gt;
  
  &lt;/RadioButton&gt;
  </code></pre>
  
  <p>this is what i am getting.. </p>
  
  <p>I want the green border to be the selected item. not what the Listbox's Selected item is. The bottom text box is the name of the selected item.
  <img src="https://i.stack.imgur.com/aX1f8.png" alt="What the outcome of that code is"></p>