title: WPF: How to create events for custom usercontrols?
body: <p>I have created a <code>UserControl</code> that consists of an <code>ItemsCollection</code>. Each item in this collection consists of a <code>ListBox</code>. </p>
  
  <p>My application is represented by a <code>Window</code>, which contains this <code>UserControl</code>. I want to be able to manage events related to items inside the <code>ListBox</code>. How can I achieve this? (I am not sure if this is relevant or not, but the <code>UserControl</code> is in a assembly different from the application.)</p>
  
  <p>Here's the code of the <code>UserControl</code>: </p>
  
  <pre><code>&lt;UserControl 
      x:Class="UserControls.CalendarMonthViewControl.CalendarMonthView"
      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:DesignWidth="580" 
      d:DesignHeight="300" 
      xmlns:calendarMonthViewControl="clr-namespace:UserControls.CalendarMonthViewControl" 
      Name="CalendarMonthViewControl"&gt;
    &lt;Grid&gt;
      &lt;ItemsControl 
          ItemsSource="{Binding ElementName=CalendarMonthViewControl, Path=Days}"&gt;
        &lt;ItemsControl.ItemsPanel&gt;
          &lt;ItemsPanelTemplate&gt;
            &lt;UniformGrid Rows="6" Columns="7" /&gt;
          &lt;/ItemsPanelTemplate&gt;
        &lt;/ItemsControl.ItemsPanel&gt;
        &lt;ItemsControl.ItemTemplate&gt;
          &lt;DataTemplate DataType="{x:Type calendarMonthViewControl:Day}"&gt;
            &lt;Border&gt;
              &lt;Grid&gt;
                &lt;ListBox ItemsSource="{Binding Path=CalendarDayItems}" /&gt;
              &lt;/Grid&gt;
            &lt;/Border&gt;
          &lt;/DataTemplate&gt;
        &lt;/ItemsControl.ItemTemplate&gt;
      &lt;/ItemsControl&gt;
    &lt;/Grid&gt;
  &lt;/UserControl&gt;
  </code></pre>