private void InitializeLayouts() { foreach (var layout in keyboard.GetLayouts()) { var button = new KeyboardLayoutButton(layout); button.LayoutSelected += (o, args) => ActivateLayout(layout); LayoutsStackPanel.Children.Add(button); if (layout.IsCurrent) { SetCurrent(layout); } } }