私のアプリケーションは次のようになります。
1 Window
2 Frame
3 Page
4 Control
コントロール (4) には、フレーム (2) で処理するカスタム ルーティング イベントがあります。
行事:
public static readonly RoutedEvent PreviewArtistLinkClickedEvent = EventManager.RegisterRoutedEvent(
"PreviewArtistLinkClicked", RoutingStrategy.Tunnel, typeof(RoutedEventHandler), typeof(Hyperlink));
public event RoutedEventHandler PreviewAlbumLinkClicked {
add { AddHandler(PreviewAlbumLinkClickedEvent, value); }
remove { RemoveHandler(PreviewAlbumLinkClickedEvent, value); }
}
void RaisePreviewArtistLinkClickedEvent(object sender, RoutedEventArgs e) {
RoutedEventArgs eventArgs = new RoutedEventArgs(Tracklist.PreviewArtistLinkClickedEvent);
RaiseEvent(eventArgs);
}
そしてフレーム XAML:
<Frame Name="frameContent" Grid.Column="1" Background="#373737" NavigationUIVisibility="Hidden"
gui:Tracklist.PreviewArtistLinkClicked="frameContent_PreviewArtistLinkClicked"/>
正常にコンパイルされますが、次のことが起こります。
「PreviewArtistLinkClicked」という名前のプロパティの DependencyProperty または PropertyInfo が見つかりません。