Click here to Skip to main content
15,899,313 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi
do someone know how to define
the maui editor so its scroll text
horizontal and vertical

thanks

What I have tried:

I tried to nest the editor inside
a scrollview with vertical and horizontal
scroll bar set to always

but nothing seen


<?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="MauiApp1.MainPage">

    <ScrollView>
        <VerticalStackLayout Background="Aqua" Spacing="0" Padding="0">

             <Label 
                Text="Puzzle"
                FontSize="24"
                HorizontalOptions="Start" />

            <Border 
                    Padding="4,0"
                    HeightRequest="300" >
                <ScrollView HeightRequest="300"
                            HorizontalScrollBarVisibility="Always"
                            VerticalScrollBarVisibility="Always" WidthRequest="380" IsEnabled="True" ZIndex="2000">
             
                <Editor 
                   Background="White"                
                   IsEnabled="True"
                   IsTextPredictionEnabled="True"
                   TextTransform="Uppercase"
                   CharacterSpacing="2"
                   Placeholder="Input your puzzle here"
                   PlaceholderColor="Black"
                   FontSize="14"
                   FontFamily="Monospace"
                     />
                    
                </ScrollView>
            </Border>

            <Label 
                Text="Current count: 0"
                FontSize="18"
                FontAttributes="Bold"
                x:Name="CounterLabel"
                HorizontalOptions="Center" />

            <Button 
                Text="Click me"
                FontAttributes="Bold"
                SemanticProperties.Hint="Counts the number of times you click"
                Clicked="OnCounterClicked"
                HorizontalOptions="Center" />

        </VerticalStackLayout>
    </ScrollView>
</ContentPage>
Posted
Updated 7-May-22 18:03pm
v3
Comments
[no name] 6-May-22 12:30pm    
Did you try it without the ScrollView? Or maybe just a button? Incremental development. One scrolls when one needs to; not because one can.
Member 13569650 7-May-22 14:31pm    
yes I tried

but l am a beginner
and I need example to start with

I need an editor with behaviour
like a textbox with scroll bars

thank you

1 solution

This work with vertical scrolling but I want also horizontal scrolling
and yet I don't understand how its work.



<?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="MauiApp1.MainPage">

    <ScrollView>
        <VerticalStackLayout Background="Aqua" Spacing="0" Padding="0">

             <Label 
                Text="Puzzle"
                FontSize="24"
                HorizontalOptions="Start" />

            <ScrollView 
                Orientation="Vertical" VerticalScrollBarVisibility="Default" MinimumHeightRequest="350" MinimumWidthRequest="350" MaximumHeightRequest="350" MaximumWidthRequest="350">
                <Editor x:Name="editor" Background="White"
					VerticalOptions="FillAndExpand"
                    VerticalTextAlignment="Start"
					AutoSize="TextChanges" />
            </ScrollView>

            <Label 
                Text="Current count: 0"
                FontSize="18"
                FontAttributes="Bold"
                x:Name="CounterLabel"
                HorizontalOptions="Center" />

            <Button 
                Text="Click me"
                FontAttributes="Bold"
                SemanticProperties.Hint="Counts the number of times you click"
                Clicked="OnCounterClicked"
                HorizontalOptions="Center" />

        </VerticalStackLayout>
    </ScrollView>
</ContentPage>
 
Share this answer
 
Comments
Graeme_Grant 8-May-22 0:31am    
I have not started with MAUI, but everything in your code says Vertical, no Horizontal. That is where I would be looking.
Member 13569650 8-May-22 23:14pm    
there is a both parameter that
I tried it but still only vertical
scroll is working with this parameter
set
Graeme_Grant 8-May-22 23:26pm    

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900