Won't Fix
Last Updated: 15 Feb 2024 15:59 by Petar
Janusz
Created on: 05 Feb 2024 07:06
Category: VirtualKeyboard
Type: Bug Report
0
VirtualKeyboard: The keyboard layout is not correct when using the Polish culture
The keyboard layout is not correct when using the Polish culture.
2 comments
Petar
Posted on: 15 Feb 2024 15:59

You cna use this code to display the Alt symbols needed to visualize the Polish Programmer keyboard:

   Use VirtualKeyboardTemplateSelectorto add additional element which displays the AltText property:

    <Window.Resources>
        <telerik:BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" />
        <telerik:VirtualKeyboardTemplateSelector x:Key="KeyTemplateSelector">
            <telerik:VirtualKeyboardTemplateSelector.RegularTemplate>
                <DataTemplate>
                    <telerik:RadButton Command="{Binding KeyCommand}" VerticalContentAlignment="Stretch" HorizontalContentAlignment="Stretch" Padding="0" 
                                   Background="{Binding Background}" Foreground="{Binding Foreground}">
                        <Grid>
                            <Grid.RowDefinitions>
                                <RowDefinition/>
                                <RowDefinition/>
                            </Grid.RowDefinitions>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition/>
                                <ColumnDefinition/>
                            </Grid.ColumnDefinitions>
                            <TextBlock Text="{Binding ShiftText}"  
                                   Margin="3 0 0 0"  
                                   Visibility="{Binding ShowSecondaryText, Converter={StaticResource BooleanToVisibilityConverter}}"/>
                            <TextBlock Text="{Binding DisplayText}" Grid.RowSpan="2" Grid.ColumnSpan="2" HorizontalAlignment="Center" VerticalAlignment="Center"/>
                            <TextBlock Text="{Binding AltText}" FontWeight="Bold" Foreground="Blue" Grid.Row="1" Grid.Column="1" HorizontalAlignment="Center" VerticalAlignment="Center"/>
                        </Grid>
                    </telerik:RadButton>
                </DataTemplate>
            </telerik:VirtualKeyboardTemplateSelector.RegularTemplate>
            <telerik:VirtualKeyboardTemplateSelector.SpecialTemplate>
                <DataTemplate>
                    <telerik:RadButton Content="{Binding DisplayText}" Command="{Binding KeyCommand}" Padding="0" 
                                   Background="{Binding Background}" Foreground="{Binding Foreground}"/>
                </DataTemplate>
            </telerik:VirtualKeyboardTemplateSelector.SpecialTemplate>
            <telerik:VirtualKeyboardTemplateSelector.NumpadTemplate>
                <DataTemplate>
                    <telerik:RadButton Content="{Binding DisplayText}" Command="{Binding KeyCommand}" Padding="0" 
                                   Background="{Binding Background}" Foreground="{Binding Foreground}"/>
                </DataTemplate>
            </telerik:VirtualKeyboardTemplateSelector.NumpadTemplate>
            <telerik:VirtualKeyboardTemplateSelector.LockTemplate>
                <DataTemplate>
                    <telerik:RadToggleButton Content="{Binding DisplayText}" Command="{Binding KeyCommand}" IsChecked="{Binding IsChecked}"  
                                         Background="{Binding Background}" Foreground="{Binding Foreground}"/>
                </DataTemplate>
            </telerik:VirtualKeyboardTemplateSelector.LockTemplate>
        </telerik:VirtualKeyboardTemplateSelector>
    </Window.Resources>
    <Grid>
        <TextBox VerticalAlignment="Top" Margin="10" />
        
        <telerik:RadVirtualKeyboard Culture="pl-PL" SynchronizeCultureWithSystem="False" Margin="0 40 0 0"
                                    
                                    VirtualKeyboardTemplateSelector="{StaticResource KeyTemplateSelector}"/>

To have them function as expected, we need to implement additional feature related to AltGR key logged here:
https://feedback.telerik.com/wpf/1604250-virtualkeyboard-altgr-key-is-not-working-as-intended-on-cultures-that-use-it-as-a-special-keys-modifier