private void TabMouseDown(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Left && ShowCloseButton != CloseState.None && !HideCloseButtonIndex.Any(k => k == SelectedIndex))//是鼠标右击,并且是显示关闭按钮 { //计算关闭区域 Rectangle tabRect = this.GetTabRect(this.SelectedIndex); //如果鼠标在区域内就关闭选项卡 if (e.X >= (tabRect.Right - CLOSE_IMAGE_WIDTH - 1) && e.X < tabRect.Right && e.Y >= tabRect.Y && e.Y <= tabRect.Y + CLOSE_IMAGE_WIDTH) { CloseButtonClickEvent?.Invoke(this, e); //Console.WriteLine($"点击关闭按钮事件,当前坐标为{e.X},{e.Y},点击关闭的选项卡Index为【{this.SelectedIndex}】"); } } }
private void OnCloseButtonClickHandler() { CloseButtonClickEvent?.Invoke(); }
private void BtnClose_Click(object sender, RoutedEventArgs e) { CloseButtonClickEvent.BeginInvoke(BtnClose, null, null, null); }
private void ContentDialog_SecondaryButtonClick(ContentDialog sender, ContentDialogButtonClickEventArgs args) { CloseButtonClickEvent?.Invoke(sender, args); }