void imgComment_MouseLeftButtonUp(object sender, MouseButtonEventArgs e) { // dispatch some sort of event for ViewState changed PinWheelViewStateChangeEventArgs args = new PinWheelViewStateChangeEventArgs(ViewState.CommentViewState); if (ViewStateChange != null) { ViewStateChange(this, args); } }
public PinWheel() { InitializeComponent(); imgStar.MouseLeftButtonUp += imgStar_MouseLeftButtonUp; imgComment.MouseLeftButtonUp += imgComment_MouseLeftButtonUp; imgTag.MouseLeftButtonUp += imgTag_MouseLeftButtonUp; imgInfo.MouseLeftButtonUp += imgInfo_MouseLeftButtonUp; Loaded += (s, e) => { PinWheelViewStateChangeEventArgs args = new PinWheelViewStateChangeEventArgs(ViewState.InfoViewState); if (ViewStateChange != null) { ViewStateChange(this, args); } linkInfo.Focus(); }; }
void pinWheel_ViewStateChange(object sender, PinWheelViewStateChangeEventArgs e) { CurrentView.Visibility = Visibility.Collapsed; switch (e.viewState) { case ViewState.InfoViewState : CurrentView = this.infoViewBox; break; case ViewState.CommentViewState : CurrentView = this.commentViewBox; break; case ViewState.RatingViewState : CurrentView = this.ratingViewBox; break; case ViewState.TagViewState : CurrentView = this.tagViewBox; break; } CurrentView.Opacity = ( e.viewState == ViewState.AnimatingState ) ? 0 : 1; CurrentView.Visibility = Visibility.Visible; }