C
C#13mo ago
bribri

✅ Problems with wrapping in wpf Listbox

I'm using an listbox to to list multiple options with an image and title. But I want to let my title wrap when smaller etc but I can't seem to do it ... You can see it in image and my code for the box. Should I use listbox for this or an other control? I really need the scroll option for it. (this is still early with some placeholder stuff)
<ListBox Grid.Column="1" ScrollViewer.CanContentScroll="False">
<ListBoxItem>
<StackPanel Orientation="Horizontal">
<TextBlock x:Name="titel" HorizontalAlignment="Center" VerticalAlignment="Center" TextWrapping="WrapWithOverflow"/>
<Image Source="placeholder.png" Width="150" Height="150" HorizontalAlignment="Right"/>
</StackPanel>
</ListBoxItem>
</ListBox>
<ListBox Grid.Column="1" ScrollViewer.CanContentScroll="False">
<ListBoxItem>
<StackPanel Orientation="Horizontal">
<TextBlock x:Name="titel" HorizontalAlignment="Center" VerticalAlignment="Center" TextWrapping="WrapWithOverflow"/>
<Image Source="placeholder.png" Width="150" Height="150" HorizontalAlignment="Right"/>
</StackPanel>
</ListBoxItem>
</ListBox>
5 Replies
HimmDawg
HimmDawg13mo ago
What about TextWrapping="Wrap" instead of TextWrapping="WrapWithOverflow"? Also, this seems to be quite a corner case where the text just barely touches the image. You can maybe introduce some margin on the right side with Margin="0, 0, 5, 0" on your textblock
bribri
bribri13mo ago
tried also doesn't work... Oh yeah wanted to first try to get everything kind of working and then looking for font,size, colors etc
Accord
Accord13mo ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.
bribri
bribri13mo ago
/close -
Accord
Accord13mo ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.
Want results from more Discord servers?
Add your server
More Posts