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