Posted 13 February 2019, 6:50 pm EST
The attachemnt was not sent, vwnt thoought it was droped-
the two files as plain text:
MainWindowsxaml
<c1:C1Calendar x:Name=“_cal” Focusable=“True” GotKeyboardFocus=“C1Calendar_GotKeyboardFocus”
LostKeyboardFocus=“C1Calendar_LostKeyboardFocus” Canvas.Left=“280” Canvas.Top=“120” />
MainWindow.xaml.cs:
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Windows.Threading;
using C1Calendar;
namespace C1Calendar {
///
/// Interaktionslogik für MainWindow.xaml
///
public partial class MainWindow : Window {
public MainWindow() {
InitializeComponent();
}
private void C1Calendar_GotKeyboardFocus(object sender, KeyboardFocusChangedEventArgs e) {
Debug.WriteLine("In GotKeyboardFocus");
_cal.SelectedDate = DateTime.Today;
}
private void C1Calendar_LostKeyboardFocus(object sender, KeyboardFocusChangedEventArgs e) {
Debug.WriteLine("In LostKeyboardFocus");
}
private void Button_Click(object sender, RoutedEventArgs e) {
var sucess = _cal.Focus();
var focusedElement = Keyboard.Focus(_cal);
Debug.WriteLine($"Setting KeyboardFocus to _calendar: {sucess}. Focus has {focusedElement}");
}
private void Button_LostKeyboardFocus(object sender, KeyboardFocusChangedEventArgs e) {
Debug.WriteLine("In Button_LostFocus");
}
}
}