C# WPF 句号在错误的一侧

本文关键字:错误 WPF | 更新日期: 2023-09-27 18:31:25

我有一个 wpf 应用程序,其窗体包含以下 XAML:

<StackPanel Grid.Row="6" Grid.ColumnSpan="4" FlowDirection="RightToLeft" Orientation="Horizontal">
    <!-- reverse order, because of flow direction-->
    <Button Content="Cancel" IsCancel="True" KeyboardNavigation.TabIndex="101"/>
    <Button Content="Save" Command="{Binding Path=SaveCommand}" IsDefault="True" KeyboardNavigation.TabIndex="100"/>
    <TextBlock Text="{Binding Path=Warning}" VerticalAlignment="Center" Foreground="Red" />
</StackPanel>

它是用于保存或放弃更改的表单。窗体连接到包含两个命令(SaveCommandCancelCommand)和一个属性Warning的视图模型。

我对此有以下问题:当视图模型的属性Warning返回string"这是一个重要的警告"时,末尾的点出现在左侧。运行应用程序时,窗体上的文本如下所示:".这是一个重要的警告"。

任何人都可以帮助我。

C# WPF 句号在错误的一侧

FlowDirection 属性由子元素继承:

由于属性值继承,在元素上设置 FlowDirection 可能会在未在本地或通过其他方式(如样式)设置 FlowDirection 的所有子元素上设置 FlowDirection。

您应该将TextBlockFlowDirection设置回"从左到右"。