Wpf scale to textBox, textBox cannot display cursor when I click textBox

First, I scale (ScaleTransform) TextBox, then click on the button TextBox. Sometimes the cursor may be displayed, and sometimes the cursor may not be displayed. Looking for a solution to the problem. I hope that I can show the cursor after scaling TextBox.

 <Grid>
    <StackPanel>
        <TextBox Width="200"></TextBox>
        <TextBox Width="100"></TextBox>
        <TextBox Width="300"></TextBox>
        <TextBox Width="100"></TextBox>
        <TextBox Width="100"></TextBox>
        <TextBox Width="100"></TextBox>
    </StackPanel>
    <Grid.LayoutTransform>
        <ScaleTransform ScaleX="0.3" ScaleY="0.65"></ScaleTransform>
    </Grid.LayoutTransform>
</Grid>
+1
source share
2 answers

A TextBox, TextBox, . , TextBox , FontSize, , .

+1

msdn :

, , TextBox FontSize . TextBox , .

, . FontSize 10. DataBinding, scaletransform .

<Grid Background="AliceBlue">
<StackPanel>
<Border Height="100">
  <Canvas>
    <TextBox Canvas.Left="50" Canvas.Top="40" Width="500" Height="100" Background="Silver" Text="A Quick Red Fox Jumped Over A Lazy Brown Dog." FontSize="20"/>
    <Canvas.RenderTransform>
      <ScaleTransform ScaleX="0.5" ScaleY="0.5"/>
    </Canvas.RenderTransform>
  </Canvas>
</Border>
<Border Height="100">
  <Canvas>
    <Grid Canvas.Left="50" Canvas.Top="40" Width="500" Height="100">
      <TextBox Background="Silver" Text="A Quick Red Fox Jumped Over A Lazy Brown Dog." FontSize="10" LayoutTransform="{Binding ElementName=scale, Path=Inverse}"/>
    </Grid>
    <Canvas.RenderTransform>
      <ScaleTransform x:Name="scale" ScaleX="0.5" ScaleY="0.5"/>
    </Canvas.RenderTransform>
  </Canvas>
</Border>

: http://social.msdn.microsoft.com/Forums/en/wpf/thread/aeaa3e28-a7da-4208-9676-771231c1a954?prof=required

0

Source: https://habr.com/ru/post/1664821/


All Articles