in my ListBox ItemTemplate i want set TextBlock UnderLine.
as fllow:
<StackPanel x:Name="TaskContent_SP" Orientation="Horizontal" Background="#16191B" Height="80" Width="455" >
<Grid x:Name="DonePreDragCoreItem_GD" >
<TextBlock x:Name="TaskNameItem_TB" Canvas.ZIndex="0" Text="{Binding TaskName}" Margin="10,10,10,10" HorizontalAlignment="Left" Foreground="#414444" FontWeight="ExtraLight" FontSize="30"></TextBlock>
<Line x:Name="DoneForgroundLine_LE" Stroke="#414444" StrokeThickness="4"
X1="0" X2="{Binding ElementName=TaskNameItem_TB,Path=ActualWidth}"
Canvas.ZIndex="1" Margin="10,33,10,10"></Line>
</Grid>
</StackPanel>
if i don’t use Databinding set Textblock text value. ActualWidth have normal value。 otherwise it will still 0.
how to get ActualWidth value when datebinding ?
You cannot get ActualWidth in binding because it is not a DependencyProperty. You can get a line on the bottom by using a Border