728x90
728x170

CustomExpandEditor Class 를 작성합니다.

    public class CustomExpandEditor : Editor
    {
        public static BindableProperty IsExpandableProperty
        = BindableProperty.Create(nameof(IsExpandable), typeof(bool), typeof(CustomExpandEditor), false);

        public bool IsExpandable
        {
            get { return (bool)GetValue(IsExpandableProperty); }
            set { SetValue(IsExpandableProperty, value); }
        }

        public CustomExpandEditor()
        {
            TextChanged += OnTextChanged;
        }

        private void OnTextChanged(object sender, TextChangedEventArgs e)
        {
            if (IsExpandable) InvalidateMeasure();
        }
    }

 

xaml 에 아래처럼 작성합니다.

        <cntrols:CustomExpandEditor x:Name="memoEditor"
                                    IsExpandable="true"
                                    Placeholder = "내용"
                                    PlaceholderColor="#95969B"
                                    BackgroundColor="SkyBlue"
                                    Margin="7,0,7,0"
                                    MaxLength="50" />

IsExpandable 이 true 인 경우에는 글자 수에 따라서 글자가 잘리지 않고 크기가 늘어납니다.


 Android

iOS



 

 

728x90
그리드형
Posted by kjun.kr
,