Пример #1
0
        protected async override void OnAppearing()
        {
            ViewModel.CustomerInfo = await ViewModel.GetCustomerInfo(CutomerOid);

            _Customer = ViewModel.CustomerInfo;

            Button _Button = new Button()
            {
                Text            = "Cancel",
                BackgroundColor = Color.Black,
                VerticalOptions = LayoutOptions.End,
                TextColor       = Color.White,
                Margin          = new Thickness(10, 4),
            };

            _Button.Clicked += async(sender, EventArgs) => await CancelClicked(sender, EventArgs);

            DataFormView _dataForm = new DataFormView()
            {
                DataObject                = _Customer,
                Margin                    = 25,
                EditorLabelColor          = Color.Black,
                IsEnabled                 = false,
                EditorLabelFontSize       = 18,
                HorizontalOptions         = LayoutOptions.Center,
                EditorLabelPosition       = DataFormLabelPosition.Top,
                EditorLabelFontAttributes = FontAttributes.Bold
            };
            ScrollView _ScrollView = new ScrollView()
            {
                Content = _dataForm,
            };
            StackLayout ContainerStack = new StackLayout()
            {
                Children = { _ScrollView, _Button }
            };
            Frame _Frame = new Frame()
            {
                Content         = ContainerStack,
                Margin          = 20,
                BackgroundColor = Color.White,
                VerticalOptions = LayoutOptions.Center,
                Padding         = 0,
                CornerRadius    = 12
            };

            Content        = _Frame;
            BindingContext = ViewModel;
        }
 public void Rotate(DataFormView dataForm, bool newIsVertical)
 {
     if (newIsVertical != isVertical)
     {
         if (dataForm.Items != null)
         {
             isVertical = newIsVertical;
             foreach (KeyValuePair <string, bool> fieldName in fieldNamesToReorder)
             {
                 DataFormItem item     = dataForm.Items.FirstOrDefault(i => i.FieldName == fieldName.Key);
                 int          modifier = newIsVertical ? 1 : -1;
                 if (item != null)
                 {
                     item.RowOrder += modifier;
                     if (fieldName.Value)
                     {
                         item.IsLabelVisible = newIsVertical;
                     }
                 }
             }
         }
     }
 }