private void SetupControl(ILogicalKey key) { _keyText?.SetBinding(TextBlock.TextProperty, new Binding("DisplayName") { Source = key }); key.PropertyChanged += Key_PropertyChanged; key.LogicalKeyPressed += Key_VirtualKeyPressed; }
private void SetupControl(ILogicalKey key) { CornerRadius = new CornerRadius(3); BorderBrush = _keyOutsideBorderBrush; BorderThickness = new Thickness(1); SnapsToDevicePixels = true; var g = new Grid(); Child = g; _keySurface = new Border { CornerRadius = new CornerRadius(3), BorderBrush = _keySurfaceBorderBrush, BorderThickness = new Thickness(1), Background = _keySurfaceBrush, SnapsToDevicePixels = true }; g.Children.Add(_keySurface); _mouseDownSurface = new Border { CornerRadius = new CornerRadius(3), Background = Brushes.White, Opacity = 0, SnapsToDevicePixels = true }; g.Children.Add(_mouseDownSurface); _keyText = new TextBlock { Margin = new Thickness(3, 0, 0, 0), FontSize = 20, HorizontalAlignment = HorizontalAlignment.Left, VerticalAlignment = VerticalAlignment.Top, Foreground = Brushes.White, SnapsToDevicePixels = true }; _keyText.SetBinding(TextBlock.TextProperty, new Binding("DisplayName") { Source = key }); g.Children.Add(_keyText); key.PropertyChanged += Key_PropertyChanged; key.LogicalKeyPressed += Key_VirtualKeyPressed; _hoverTimer = new System.Timers.Timer(800); _hoverTimer.Elapsed += TimerKeyTriggered; _hoverTimer.AutoReset = false; _repeatTimer = new System.Timers.Timer(1500); _repeatTimer.Elapsed += RepeatKeyTriggered; _repeatTimer.Enabled = false; _repeatTimer.AutoReset = false; }
private void SetupControl(ILogicalKey key) { // CornerRadius = new CornerRadius(3); // BorderBrush = _keyOutsideBorderBrush; // BorderThickness = new Thickness(1); // SnapsToDevicePixels = true; var g = new Grid(); Child = g; _keySurface = new Border { //CornerRadius = new CornerRadius(3), //BorderBrush = _keySurfaceBorderBrush, //BorderThickness = new Thickness(1), Background = _keySurfaceBrush, Margin = new Thickness(2) //SnapsToDevicePixels = true }; g.Children.Add(_keySurface); _mouseDownSurface = new Border { //CornerRadius = new CornerRadius(3), Background = Brushes.White, Opacity = 0, //SnapsToDevicePixels = true }; g.Children.Add(_mouseDownSurface); _keyText = new TextBlock { Margin = new Thickness(3, 0, 0, 0), FontSize = 36, HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Center, Foreground = Brushes.White, //SnapsToDevicePixels = true }; _keyText.SetBinding(TextBlock.TextProperty, new Binding("DisplayName") { Source = key }); g.Children.Add(_keyText); key.PropertyChanged += Key_PropertyChanged; key.LogicalKeyPressed += Key_VirtualKeyPressed; }
private void SetupControl(ILogicalKey key) { CornerRadius = new CornerRadius(3); BorderBrush = _keyOutsideBorderBrush; BorderThickness = new Thickness(1); SnapsToDevicePixels = true; var g = new Grid(); Child = g; _keySurface = new Border { CornerRadius = new CornerRadius(3), BorderBrush = _keySurfaceBorderBrush, BorderThickness = new Thickness(1), Background = _keySurfaceBrush, SnapsToDevicePixels = true }; g.Children.Add(_keySurface); _mouseDownSurface = new Border { CornerRadius = new CornerRadius(3), Background = Brushes.White, Opacity = 0, SnapsToDevicePixels = true }; g.Children.Add(_mouseDownSurface); _keyText = new TextBlock { Margin = new Thickness(3, 0, 0, 0), FontSize = 20, HorizontalAlignment = HorizontalAlignment.Left, VerticalAlignment = VerticalAlignment.Top, Foreground = Brushes.White, SnapsToDevicePixels = true }; _keyText.SetBinding(TextBlock.TextProperty, new Binding("DisplayName") { Source = key }); g.Children.Add(_keyText); key.PropertyChanged += Key_PropertyChanged; key.LogicalKeyPressed += Key_VirtualKeyPressed; }
public LogicalKeyEventArgs(ILogicalKey key) { Key = key; }
private void SetupControl(ILogicalKey key) { // CornerRadius = new CornerRadius(6); // BorderBrush = _keyOutsideBorderBrush; BorderThickness = new Thickness(0); SnapsToDevicePixels = true; Margin = new Thickness(0, 0, 11, 16); var g = new Grid() { Width = 59.0, Height = 89.0 }; Child = g; _keySurface = new Border { CornerRadius = new CornerRadius(8), // BorderBrush = _keySurfaceBorderBrush, BorderThickness = new Thickness(0), Background = _keySurfaceBrush, SnapsToDevicePixels = true, }; g.Children.Add(_keySurface); _mouseDownSurface = new Border { CornerRadius = new CornerRadius(8), BorderThickness = new Thickness(0), Background = Brushes.White, Opacity = 0, SnapsToDevicePixels = true, // Margin = new Thickness(3, 3, 0, 0) }; g.Children.Add(_mouseDownSurface); // var viewbox = new Viewbox // { // VerticalAlignment = VerticalAlignment.Center, // Margin = new Thickness(0, 0, 0, 5) // }; if (key.DisplayName == "Bksp") { var image = new Image { Source = new BitmapImage(new Uri("../../Images/backspace.png", UriKind.Relative)), Margin = new Thickness(10, 0, 10, 0) }; g.Children.Add(image); } else { _keyText = new TextBlock { FontSize = 38, HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Center, Foreground = Brushes.White, SnapsToDevicePixels = true }; _keyText.SetBinding(TextBlock.TextProperty, new Binding("DisplayName") { Source = key }); g.Children.Add(_keyText); } // viewbox.Child = _keyText; // g.Children.Add(viewbox); key.PropertyChanged += Key_PropertyChanged; key.LogicalKeyPressed += Key_VirtualKeyPressed; }
private void SetupControl(ILogicalKey key) { CornerRadius = new CornerRadius(3); BorderBrush = _keyOutsideBorderBrush; BorderThickness = new Thickness(1); //FDN: aggiungiamo un margine tra i vari tasti Thickness margin = this.Margin; margin.Left = 8; // 5; margin.Top = 8; //5; margin.Right = 8; //5; margin.Bottom = 8; //5; this.Margin = margin; //Thickness padding = this.Padding; //padding.Left = 0; //padding.Top = 0; //padding.Right = 0; //padding.Bottom = 0; //this.Padding = padding; SnapsToDevicePixels = true; var g = new Grid(); Child = g; if (KeyBackground == null) { _keySurface = new Border { CornerRadius = new CornerRadius(3), BorderBrush = _keySurfaceBorderBrush, BorderThickness = new Thickness(1), Background = _keySurfaceBrush, // FDN: questa proprietà cambia colore allo sonfdo del tasto SnapsToDevicePixels = true }; } else { _keySurface = new Border { CornerRadius = new CornerRadius(3), BorderBrush = _keySurfaceBorderBrush, BorderThickness = new Thickness(1), Background = (SolidColorBrush) new BrushConverter().ConvertFromString(KeyBackground), // FDN: questa proprietà cambia colore allo sonfdo del tasto SnapsToDevicePixels = true }; } g.Children.Add(_keySurface); _mouseDownSurface = new Border { CornerRadius = new CornerRadius(3), Background = Brushes.White, Opacity = 0, SnapsToDevicePixels = true }; g.Children.Add(_mouseDownSurface); //FDN: agire quì se si vuole modificare il Layout della tastiera _keyText = new TextBlock { Margin = new Thickness(3, 3, 3, 3), FontSize = 20, HorizontalAlignment = HorizontalAlignment.Left, VerticalAlignment = VerticalAlignment.Top, Foreground = Brushes.White, SnapsToDevicePixels = true }; _keyText.SetBinding(TextBlock.TextProperty, new Binding("DisplayName") { Source = key }); g.Children.Add(_keyText); key.PropertyChanged += Key_PropertyChanged; key.LogicalKeyPressed += Key_VirtualKeyPressed; }