locked
RichEditBox没有光标,也没有焦点? RRS feed

  • 问题

  • 我在Popup里放一个RichEditBox,当Popup弹出时,我鼠标点击RichEditBox时,根本没有光标在闪烁,也无法使用键盘输入任何字母,当我点击windows键转到桌面再点击windows键进入时,RichEditBox出现,键盘也可以使用了,请问板主,为什么会这样? TextBox也是这种情况啊,不解不解
    2012年9月11日 7:23

答案

  • 这个我觉得是你项目的问题,我建议你建个空的app,然后试试放个RichTextColumns,看看里面的input控件能不能输入,我这边是没有问题的:

            <Popup x:Name="myPopup" Margin="-34,0,-31,0" Grid.Row="2" Grid.Column="1" Height="100" VerticalAlignment="Bottom"  >
                <Grid x:Name="columnGrid" Background="White" Width="900" Height="300">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition/>
                        <ColumnDefinition/>
                        <ColumnDefinition/>
                    </Grid.ColumnDefinitions>
                    <RichTextBlock Grid.Column="0" IsTextSelectionEnabled="True"  TextAlignment="Justify" 
    OverflowContentTarget="{Binding ElementName=firstOverflowContainer}" 
    TextIndent="12"
    FontSize="12" FontFamily="Segoe UI" Foreground="#2a2a2a" Margin="20,0">
                        <Paragraph>
                            <InlineUIContainer>
                                <Border Background="Black">
                                    <RichEditBox/>
                                </Border>
                            </InlineUIContainer>
                        </Paragraph>
                    </RichTextBlock>
                    <RichTextBlockOverflow x:Name="firstOverflowContainer" Grid.Column="1" Margin="20,0"
            OverflowContentTarget="{Binding ElementName=secondOverflowContainer}"/>
                    <RichTextBlockOverflow x:Name="secondOverflowContainer" Grid.Column="2" Margin="20,0"/>
                </Grid>
            </Popup>


    Sheldon _Xiao[MSFT]
    MSDN Community Support | Feedback to us
    Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    2012年9月12日 1:49
  • 在InlineUIContainer内放两个控件就会导致问题的出现,放一个控件没问题,现在已经解决了
    2012年9月12日 2:11

全部回复

  • 这个问题暂时还没遇到过, 我这边也没重现, 是不是跟你本地的机器有些关系,我用下面的代码尝试重现:

    <Grid Background="AliceBlue">
        <Grid x:Name="ContentRoot" Background="LimeGreen" Margin="100,20,100,20">
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="*"/>
                <RowDefinition Height="Auto"/>
            </Grid.RowDefinitions>
            <Grid HorizontalAlignment="Center" VerticalAlignment="Top">
                <StackPanel>
                    <TextBlock Text="Popup Control "  Foreground="Red"  FontSize="50" ></TextBlock>
                    <Image Source="corner.jpg"  Width="400"></Image>
                    <Button x:Name="PopUpButton" Content="Detail..." Height="50" Width="100" Background="Gray"  Click="PopUpButton_Click" />
    
                    <Popup x:Name="myPopup" Margin="-34,0,-31,0" Grid.Row="2" Grid.Column="1" Height="100" VerticalAlignment="Bottom"  >
                        <Border CornerRadius="10" Background="Red" BorderThickness="2" BorderBrush="Black">
                            <StackPanel Margin="10">
                                <TextBox x:Name="PopUpText" Height="Auto" Width="Auto" FontSize="20"/>
                            </StackPanel>
                        </Border>
                    </Popup>
                </StackPanel>
            </Grid>
        </Grid>
    </Grid>
    private void PopUpButton_Click(object sender, RoutedEventArgs e)
    {
        myPopup.IsOpen = true;
        PopUpText.Text = "Free c# articles, c# tutorials, news, blogs, resources, forum for C# programming. ";
    }
    如果你的问题还是存在,可以给我提供一个可以重现的sample么?

    Sheldon _Xiao[MSFT]
    MSDN Community Support | Feedback to us
    Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    2012年9月11日 8:06
  • 在RichTextColumns里面,InlineUIContainer内放其它控件就会出现这种情况
    2012年9月11日 8:42
  • 这个我觉得是你项目的问题,我建议你建个空的app,然后试试放个RichTextColumns,看看里面的input控件能不能输入,我这边是没有问题的:

            <Popup x:Name="myPopup" Margin="-34,0,-31,0" Grid.Row="2" Grid.Column="1" Height="100" VerticalAlignment="Bottom"  >
                <Grid x:Name="columnGrid" Background="White" Width="900" Height="300">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition/>
                        <ColumnDefinition/>
                        <ColumnDefinition/>
                    </Grid.ColumnDefinitions>
                    <RichTextBlock Grid.Column="0" IsTextSelectionEnabled="True"  TextAlignment="Justify" 
    OverflowContentTarget="{Binding ElementName=firstOverflowContainer}" 
    TextIndent="12"
    FontSize="12" FontFamily="Segoe UI" Foreground="#2a2a2a" Margin="20,0">
                        <Paragraph>
                            <InlineUIContainer>
                                <Border Background="Black">
                                    <RichEditBox/>
                                </Border>
                            </InlineUIContainer>
                        </Paragraph>
                    </RichTextBlock>
                    <RichTextBlockOverflow x:Name="firstOverflowContainer" Grid.Column="1" Margin="20,0"
            OverflowContentTarget="{Binding ElementName=secondOverflowContainer}"/>
                    <RichTextBlockOverflow x:Name="secondOverflowContainer" Grid.Column="2" Margin="20,0"/>
                </Grid>
            </Popup>


    Sheldon _Xiao[MSFT]
    MSDN Community Support | Feedback to us
    Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    2012年9月12日 1:49
  • 在InlineUIContainer内放两个控件就会导致问题的出现,放一个控件没问题,现在已经解决了
    2012年9月12日 2:11
  • 好的。


    Sheldon _Xiao[MSFT]
    MSDN Community Support | Feedback to us
    Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    2012年9月12日 2:26