i had made a user control numeric pad in wpf. i want to know when i placed a control over the form. when i pressed any numeric button then it should be entered in the focused area. how to do it this is my xaml script enter code here
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Button Name="btn2" Content="2" Focusable="False" FontSize="26" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Grid.Column="1" Grid.Row=" 1" />
<Button Name="btn1" Content="1" Focusable="False" FontSize="26" HorizontalAlignment="Stretch" Grid.Row="1" VerticalAlignment="Stretch" BorderBrush="DarkGray" BorderThickness="4,2,2,8" />
<Button Name="btn3" Content="3" Focusable="False" FontSize="26" Grid.Column="2" Foreground="White" HorizontalAlignment="Stretch" Grid.Row="1" VerticalAlignment="Stretch" />
<Button Name="btn4" Content="4" Focusable="False" FontSize="26" HorizontalAlignment="Stretch" Grid.Row="2" VerticalAlignment="Stretch" />
<Button Name="btn5" Content="5" Focusable="False" FontSize="26" Grid.Column="1" HorizontalAlignment="Stretch" Grid.Row="2" VerticalAlignment="Stretch" />
<Button Name="btn6" Content="6" Focusable="False" FontSize="26" Grid.Column="2" HorizontalAlignment="Stretch" Grid.Row="2" VerticalAlignment="Stretch" />
<Button Name="btn7" Content="7" Focusable="False" FontSize="26" HorizontalAlignment="Stretch" Grid.Row="3" VerticalAlignment="Stretch" />
<Button Name="btn8" Content="8" Focusable="False" FontSize="26" Grid.Column="1" HorizontalAlignment="Stretch" Grid.Row="3" VerticalAlignment="Stretch" />
<Button Name="btn9" Content="9" Focusable="False" FontSize="26" Grid.Column="2" HorizontalAlignment="Stretch" Grid.Row="3" VerticalAlignment="Stretch" />
<Button Name="btn0" Content="0" Focusable="False" FontSize="26" HorizontalAlignment="Stretch" Grid.Row="4" VerticalAlignment="Stretch" />
<Button Name="btn00" Content="00" Focusable="False" FontSize="26" Grid.Column="1" HorizontalAlignment="Stretch" Grid.Row="4" VerticalAlignment="Stretch" />
<Button Name="btn_dot" Content="." Focusable="False" FontSize="26" Grid.Column="2" HorizontalAlignment="Stretch" Grid.Row="4" VerticalAlignment="Stretch" />
<Button Name="btn_temp1" Content="Button" Focusable="False" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" />
<Button Name="btn_temp2" Content="Button" Focusable="False" Grid.Column="1" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" />
<Button Name="btn_temp3" Content="Button" Focusable="False" Grid.Column="2" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" />
</Grid>
``
Aucun commentaire:
Enregistrer un commentaire