I have currently set the following properties to a button, and I want it to word wrap. I want the text to fit inside the button dynamically and not run off the button but it's still running off the button... any ideas?
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="quiz_app.Views.StudyPage"
Title="Study">
<StackLayout BackgroundColor="White"
Padding="100"
HorizontalOptions="CenterAndExpand"
VerticalOptions="CenterAndExpand">
<VerticalStackLayout>
<Button
Text="How much wood could a woodchuck chuck if a woodchuck could chuck wood?"
FontSize="40"
TextColor="Black"
FontFamily="Helvetica"
BackgroundColor="#CCFFCC"
VerticalOptions="CenterAndExpand"
HorizontalOptions="CenterAndExpand"
BorderWidth="5"
HeightRequest="400"
BorderColor="#82D682"
LineBreakMode='WordWrap'>
</Button>
</VerticalStackLayout>
</StackLayout>
</ContentPage>
2条答案
按热度按时间4ngedf3f1#
Just for completeness sake:
A possible solution using a
TapGestureRecognizer
could look as follows:yhxst69z2#
Thank you @ewerspej for the alternative but I could not get the GestureRecognizer to work for some reason it wasn't recognizing it as a member so I just wrapped a label inside of a border and that did what I wanted to do.
Edited code below: