XAML Dictionary でa RoutedEvent
on aを使用したいと考えています。Border
テンプレートが存在するクラスからのRoutedEvent
ものですが、どうすればこれを達成できますか?
ModernWindow.cs
/// <summary>
/// Gets fired when the logo is clicked.
/// </summary>
public static readonly RoutedEvent LogoClickEvent = EventManager.RegisterRoutedEvent("LogoClickRoutedEventHandler", RoutingStrategy.Bubble, typeof(RoutedEventHandler), typeof(ModernWindow));
/// <summary>
/// The routedeventhandler for LogoClick
/// </summary>
public event RoutedEventHandler LogoClick
{
add { AddHandler(LogoClickEvent, value); }
remove { RemoveHandler(LogoClickEvent, value); }
}
/// <summary>
///
/// </summary>
protected virtual void OnLogoClick()
{
RaiseEvent(new RoutedEventArgs(LogoClickEvent, this));
}
ModernWindow.xaml
<!-- logo -->
<Border MouseLeftButtonDown="{TemplateBinding LogoClick}" Background="{DynamicResource Accent}" Width="36" Height="36" HorizontalAlignment="Right" VerticalAlignment="Top" Margin="0,0,76,0">
<Image Source="{TemplateBinding Logo}" Stretch="UniformToFill" />
</Border>