In my wpf application, textblock text property is binded to string property of an object. String property value is "ABC-XYZ2014-HHH".
But neither textblock or textbox does not show the value correctly. Value is displayed in textblock and textbox as "ABC-XYZ2014-"
I found that Label interpret "_" or "-" as accelerator key but I am using textblock and textbox. But the value after the second "-" does not shown in the textblock and textbox. I can see the correct value in 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>
Thanks Onur
Clearly, the end of the text in the TextBlock
is getting cut off or hidden by something. You can verify this by adding a new TextBlock
with the same text into a different window... you'll see that it works straight away. So the only question here is 'what is hiding the end of the text?'
To find that out, simply set the Background
property of the surrounding elements to various colours until you see something with one of those colours over the end of the TextBlock
. You'll then know which element is hiding the end of the text.
You set the Width
of the TextBlock
and TextBox
, but you didn't set it on the StackPanel
or ScrollViewer
. My guess is that your StackPanel
is causing the problem because they are not controls that you can use to fit-to-size.