private void Button_Click(object sender, RoutedEventArgs e) { OpenFileDialog m_openDialog = new OpenFileDialog(); m_openDialog.Filter = this.Extension; if (m_openDialog.ShowDialog() == true) { Result = true; SelectedFileName = m_openDialog.FileName; this.ButtonLabel.Content = ButtonLabelContent; } else { Result = false; SelectedFileName = ""; } FileSelect?.Invoke(this, new FileSelectionArgs() { isSelected = Result, FileName = SelectedFileName }); }