I have a Listbox and each listbox item contain a DockPanel with two elements TextBlock and a Label. Following is the xaml Code -
<ListBox HorizontalContentAlignment="Stretch" ScrollViewer.HorizontalScrollBarVisibility="Disabled">
<ListBoxItem>
<DockPanel>
<TextBlock Text="Ted its so wonderfull I am gere asdf asdf asdf adsf asdf asdf asdfasf asfd asf asdf asdf asdf asdf asdasfd asf " TextWrapping="Wrap"></TextBlock>
<Label Content="Click Me" HorizontalAlignment="Right"></Label>
</DockPanel>
</ListBoxItem>
<ListBoxItem>
<DockPanel>
<TextBlock Text="Ted its so wonderfull Ted its so wonderfull I am gere asdf asdf asdf adsf asdf asdf asdfasf asfd asf asdf asdf asdf asdf asdasfd asf" TextWrapping="Wrap"></TextBlock>
<Label Content="Click Me" HorizontalAlignment="Right"></Label>
</DockPanel>
</ListBoxItem>
</ListBox>
So I was expecting a window where each row will have two elements first coloumn is the text block and the next one is a label. I added the HorizonatalContentAlignment=stretch and HorizontalAlignment=Right for labels for when user resize the window the label should go to the right end.
But the issue I am facing with the above code is when I resize the window and when the text block start to wrap, Textblock is hiding/overlapping the Label element. In some case the label is completely hidden, when a word in the text block perfectly align with the right end of the window, or is partially hidden ?
Why the second element is getting overlapped or hidden ? I want to show the click me label always, How to achieve this ?