Editor read only help

Eduardo Gomez 3,416 Reputation points
2021-08-19T13:49:00.677+00:00

Hello everyone

  UserActivity = await ActivityApi.GetActivityById(userActivityId);
                Title = UserActivity.Activity?.Topic?.Name;
                CoupleWishResponse = UserActivity?.Answer?.CoupleWishResponse;
                if (!string.IsNullOrEmpty(CoupleWishResponse))
                {
                    IsButtonVisible = false;
                    ReadOnly = false;

                }
                else
                {
                    ReadOnly = true;
                    IsButtonVisible = true;
                }

I have this VM, the calls an api and brings data, what I am trying to do is make my Editor ReadOnly if I have something back

<Frame
            Grid.Row="1"
            Grid.ColumnSpan="2"
            Padding="0"
            BackgroundColor="{x:StaticResource BackgroundColorThemeDark}"
            CornerRadius="20"
            IsClippedToBounds="True"
            VerticalOptions="FillAndExpand">

            <renderers:CustomEditor
                x:Name="MakeWishEditor"
                AutoSize="TextChanges"
                IsReadOnly="{x:Binding ReadOnly}"
                Keyboard="Chat"
                Placeholder="{i18N:Translate EnterYourAnswer}"
                Style="{x:StaticResource EditorEditorRadius}"
                Text="{x:Binding CoupleWishResponse}"
                TextColor="White" />

        </Frame>

The button work perfectly. is visible, when I don't have text, but my Editor is the problem

When I get text back I want it to be ReadOnly

Xamarin
Xamarin
A Microsoft open-source app platform for building Android and iOS apps with .NET and C#.
5,299 questions
0 comments No comments
{count} votes

Accepted answer
  1. JarvanZhang 23,951 Reputation points
    2021-08-20T02:12:42.247+00:00

    Hello @Eduardo Gomez ,​

    Welcome to our Microsoft Q&A platform!

    The button work perfectly. is visible, when I don't have text, but my Editor is the problem When I get text back I want it to be ReadOnly

    To update the UI at runtime, please make sure the binding property has raised the PropertyChanged event in the model class. For example, make the model class to inherit from the INotifyPropertyChanged interface to raise the PropertyChanged event.

    When pressing on the keyboard, the emulator’s keyboard will pop up, which causes it's like being able to enter words to the editor. This may be a potential issue with the emulator. The problem will not occur on the physical device. Please test on a physical device or don't press the keyboard before the editor is focused. When the IsReadOnly is set to False, the Editor cannot be focused on.

    Best Regards,

    Jarvan Zhang


    If the response is helpful, please click "Accept Answer" and upvote it.

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


0 additional answers

Sort by: Most helpful