当前位置: 首页>>代码示例>>C#>>正文


C# Skin.getLabelVerticalAlignment方法代码示例

本文整理汇总了C#中Skin.getLabelVerticalAlignment方法的典型用法代码示例。如果您正苦于以下问题:C# Skin.getLabelVerticalAlignment方法的具体用法?C# Skin.getLabelVerticalAlignment怎么用?C# Skin.getLabelVerticalAlignment使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Skin的用法示例。


在下文中一共展示了Skin.getLabelVerticalAlignment方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: buildCompleteView

        /// <summary>
        /// Builds complete view of field. Puts label, active element and validation element togetger in specified order.
        /// </summary>
        /// <param name="field">field of which view is created</param>
        /// <param name="skin">in this case defines dimensions of field parts</param>
        /// <returns>complete graphical representation of field</returns>
        private FrameworkElement buildCompleteView(AFField field, Skin skin)
        {
            StackPanel fullLayout = new StackPanel();
            //fullLayout.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT));

            Layout layout = field.getFieldInfo().getLayout();
            //set orientation of label and field itself
            if (layout.getLayoutOrientation() != null)
            {
                if (layout.getLayoutOrientation().Equals(LayoutOrientation.AXISY))
                {
                    fullLayout.Orientation = Orientation.Horizontal;
                }
                else if (layout.getLayoutOrientation().Equals(LayoutOrientation.AXISX))
                {
                    fullLayout.Orientation = Orientation.Vertical;
                }
            }
            else {
                fullLayout.Orientation = Orientation.Vertical; //default
            }

            //set label and field view layout params
            if (field.getLabel() != null)
            {
                if (skin.getLabelWidth() >= 0)
                {
                    field.getLabel().Width = skin.getLabelWidth();
                }
                else
                {
                    field.getLabel().HorizontalAlignment = skin.getLabelHorizontalAlignment();
                }
                if(skin.getLabelHeight() >= 0) { 
                    field.getLabel().Height = skin.getLabelHeight();
                }
                else
                {
                    field.getLabel().VerticalAlignment = skin.getLabelVerticalAlignment();
                }
            }
            field.getFieldView().Width = skin.getInputWidth();
            field.getFieldView().VerticalAlignment = VerticalAlignment.Top;

            //LABEL BEFORE
            if (field.getLabel() != null && layout.getLabelPosition() != null && !layout.getLabelPosition().Equals(LabelPosition.NONE))
            {
                if (layout.getLabelPosition().Equals(LabelPosition.BEFORE))
                {
                    fullLayout.Children.Add(field.getLabel());
                }
            }
            else if (field.getLabel() != null && layout.getLabelPosition() == null)
            {
                fullLayout.Children.Add(field.getLabel()); //default is before
            }

            if (field.getFieldView() != null)
            {
                fullLayout.Children.Add(field.getFieldView());
            }
            //LABEL AFTER
            if (field.getLabel() != null && layout.getLabelPosition() != null && !layout.getLabelPosition().Equals(LabelPosition.NONE))
            {
                if (layout.getLabelPosition().Equals(LabelPosition.AFTER))
                {
                    fullLayout.Children.Add(field.getLabel());
                }
            }

            //add errorview on the top of field
            StackPanel fullLayoutWithErrors = new StackPanel();
            fullLayoutWithErrors.HorizontalAlignment = HorizontalAlignment.Stretch;
            fullLayoutWithErrors.VerticalAlignment = VerticalAlignment.Top;
            //fullLayoutWithErrors.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT));
            fullLayoutWithErrors.Margin = new Thickness(0, 0, 10, 10);
            fullLayoutWithErrors.Orientation = Orientation.Vertical;
            fullLayoutWithErrors.Children.Add(field.getErrorView());
            fullLayoutWithErrors.Children.Add(fullLayout);
            return fullLayoutWithErrors;
        }
开发者ID:matyapav,项目名称:AFSwinx,代码行数:87,代码来源:FieldBuilder.cs


注:本文中的Skin.getLabelVerticalAlignment方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。