在我的 wpf 应用程序中,文本块文本属性绑定到对象的字符串属性。字符串属性值为“ABC-XYZ2014-HHH”。
但是文本块或文本框都不能正确显示该值。值在文本块和文本框中显示为“ABC-XYZ2014-”
我发现标签将“_”或“-”解释为加速键,但我使用的是文本块和文本框。但是第二个“-”之后的值没有显示在文本块和文本框中。我可以在 MessageBox 中看到正确的值。
<UserControl x:Class="KaliteKontrol.PresentationLayer.Denetim"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:igEditors="http://infragistics.com/Editors"
xmlns:ig="http://schemas.infragistics.com/xaml"
xmlns:GridControlLib="clr-namespace:CommonLib.Utils;assembly=CommonLib"
xmlns:commonLibUtils="clr-namespace:CommonLib.Utils;assembly=CommonLib"
xmlns:igDP="http://infragistics.com/DataPresenter"
xmlns:sys="clr-namespace:System;assembly=mscorlib"
xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="300">
<UserControl.Resources>
<BooleanToVisibilityConverter x:Key="BoolVisibilityConverter" />
<Style TargetType="ContentPresenter">
<Setter Property="RecognizesAccessKey" Value="False" />
</Style>
</UserControl.Resources>
<ScrollViewer VerticalScrollBarVisibility="Visible">
<StackPanel x:Name="mainPanel" Style="{StaticResource ResourceKey=MainWindowsStyle}" >
<Button>
<TextBlock Text="{Binding Path=Denetim.DRef}" />
</Button>
<Button IsCancel="True" >
<AccessText Margin="10,0,10,0" Text="{Binding Path=Denetim.DRef}"/>
</Button>
<TextBox Text="{Binding Path=Denetim.DRef}" Width="500" />
<TextBlock Text="{Binding Path=Denetim.DRef}" Width="800" />
<Label Content="{Binding Path=Denetim.DRef}" />
</StackPanel>
</ScrollViewer>
</UserControl>
谢谢奥努尔