xamarin可视 对讲_BoxView 类 (Xamarin.Forms) | Microsoft Docs

BoxView 类

定义

程序集:Xamarin.Forms.Core.dll

用于绘制纯色矩形的 View。A View used to draw a solid colored rectangle.

本文内容

[Xamarin.Forms.RenderWith(typeof(Xamarin.Forms.Platform._BoxViewRenderer))]

public class BoxView : Xamarin.Forms.View, Xamarin.Forms.IElementConfiguration

type BoxView = class

inherit View

interface IElementConfiguration

注解

在执行初始原型时,BoxView 是图像或自定义元素的有用的。BoxView is a useful stand-in for images or custom elements when doing initial prototyping. BoxView 的默认大小请求为40x40。BoxView has a default size request of 40x40. If you need a different size, assign the WidthRequest and HeightRequest properties.

下面的示例创建一个红色 BoxView ,其默认宽度和高度为默认值。The example below creates a red BoxView with the default width and height.

下面的示例演示了一个基本用途:The following example shows a basic use:

using System;

using Xamarin.Forms;

namespace FormsGallery

{

class BoxViewDemoPage : ContentPage

{

public BoxViewDemoPage()

{

Label header = new Label

{

Text = "BoxView",

Font = Font.BoldSystemFontOfSize(50),

HorizontalOptions = LayoutOptions.Center

};

BoxView boxView = new BoxView

{

Color = Color.Accent,

WidthRequest = 150,

HeightRequest = 150,

HorizontalOptions = LayoutOptions.Center,

VerticalOptions = LayoutOptions.CenterAndExpand

};

// Accomodate iPhone status bar.

this.Padding = new Thickness(10, Device.OnPlatform(20, 0, 0), 10, 5);

// Build the page.

this.Content = new StackLayout

{

Children =

{

header,

boxView

}

};

}

}

}

构造函数

初始化 BoxView 类的新实例。Initializes a new instance of the BoxView class.

字段

标识 Color 可绑定属性。Identifies the Color bindable property.

属性

获取或设置任何转换的中心点的 X 部分,相对于元素的边界。Gets or sets the X component of the center point for any transform, relative to the bounds of the element. 这是一种可绑定属性。This is a bindable property.

(继承自 VisualElement)

获取或设置任何转换的中心点的 Y 部分,相对于元素的边界。Gets or sets the Y component of the center point for any transform, relative to the bounds of the element. 这是一种可绑定属性。This is a bindable property.

(继承自 VisualElement)

获取或设置允许自动化框架查找此元素并与其交互的值。Gets or sets a value that allows the automation framework to find and interact with this element.

(继承自 Element)

获取或设置将填充 VisualElement 背景的颜色。Gets or sets the color which will fill the background of a VisualElement. 这是一种可绑定属性。This is a bindable property.

(继承自 VisualElement)

供 Xamarin.Forms 平台内部使用。For internal use by the Xamarin.Forms platform.

(继承自 VisualElement)

获取与此元素关联的 Behavior 列表。Gets the list of Behaviors associated to this element. 这是一种可绑定属性。This is a bindable property.

(继承自 VisualElement)

获取或设置对象,该对象包含将被属于此 BindableObject 的绑定属性设定为目标的属性。Gets or sets object that contains the properties that will be targeted by the bound properties that belong to this BindableObject.

(继承自 BindableObject)

获取元素的边界。Gets the bounds of the element.

(继承自 VisualElement)

获取或设置用于标识语义相似元素集合的值。Gets or sets a value used to identify a collection of semantically similar elements.

(继承自 Element)

获取或设置矩形的填充颜色。Gets or sets the color which will fill the rectangle. 这是一种可绑定属性。This is a bindable property.

获取或设置框视图的圆角半径。Gets or sets the corner radius for the box view.

供 Xamarin.Forms 平台内部使用。For internal use by the Xamarin.Forms platform.

(继承自 VisualElement)

供 Xamarin.Forms 平台内部使用。For internal use by the Xamarin.Forms platform.

(继承自 Element)

应用于此项的效果列表。A list of the effects that are applied to this item.

(继承自 Element)

获取或设置布局流方向。Gets or sets the layout flow direction.

(继承自 VisualElement)

获取视图的手势控制器。Gets the gesture controller for the view.

(继承自 View)

与此视图关联的手势识别器的集合。The collection of gesture recognizers associated with this view.

(继承自 View)

获取此元素的当前呈现高度。Gets the current rendered height of this element. 这是一种只读可绑定属性。This is a read-only bindable property.

(继承自 VisualElement)

获取或设置此元素的所需高度替代。Gets or sets the desired height override of this element.

(继承自 VisualElement)

获取或设置 LayoutOptions,它定义元素在布局周期中的布局方式。Gets or sets the LayoutOptions that define how the element gets laid in a layout cycle. 这是一种可绑定属性。This is a bindable property.

(继承自 View)

获取可用于通过运行应用程序唯一地标识元素的值。Gets a value that can be used to uniquely identify an element through the run of an application.

(继承自 Element)

获取或设置一个值,该值指示此元素是否应涉及用户交互周期。Gets or sets a value indicating whether this element should be involved in the user interaction cycle. 这是一种可绑定属性。This is a bindable property.

(继承自 VisualElement)

获取或设置一个值,该值指示是否在用户界面中启用此元素。Gets or sets a value indicating whether this element is enabled in the user interface. 这是一种可绑定属性。This is a bindable property.

(继承自 VisualElement)

获取一个值,该值指示当前是否聚焦此元素。Gets a value indicating whether this element is focused currently. 这是一种可绑定属性。This is a bindable property.

(继承自 VisualElement)

供 Xamarin.Forms 平台内部使用。For internal use by the Xamarin.Forms platform.

(继承自 VisualElement)

供 Xamarin.Forms 平台内部使用。For internal use by the Xamarin.Forms platform.

(继承自 VisualElement)

供 Xamarin.Forms 平台内部使用。For internal use by the Xamarin.Forms platform.

(继承自 VisualElement)

获取或设置指明此元素是否包含在选项卡导航中的值。Gets or sets a value that indicates whether this element is included in tab navigation. 这是一种可绑定属性。This is a bindable property.

(继承自 VisualElement)

获取或设置一个值,该值确定此元素是否应属于可视化树的一部分。Gets or sets a value that determines whether this elements should be part of the visual tree or not. 这是一种可绑定属性。This is a bindable property.

(继承自 VisualElement)

供 Xamarin.Forms 平台内部使用。For internal use by the Xamarin.Forms platform.

(继承自 Element)

获取或设置视图的边距。Gets or sets the margin for the view.

(继承自 View)

获取或设置一个值,该值将替代元素在布局期间请求的最小高度。Gets or sets a value which overrides the minimum height the element will request during layout.

(继承自 VisualElement)

获取或设置一个值,该值将替代元素在布局期间请求的最小宽度。Gets or sets a value which overrides the minimum width the element will request during layout.

(继承自 VisualElement)

获取或设置呈现元素时应用于元素的不透明度值。Gets or sets the opacity value applied to the element when it is rendered. 这是一种可绑定属性。This is a bindable property.

(继承自 VisualElement)

获取或设置元素的父元素。Gets or sets the parent element of the element.

(继承自 Element)

已过时。

获取作为 VisualElement 的此元素的最近的上级元素。Gets the element which is the closest ancestor of this element that is a VisualElement.

(继承自 Element)

供 Xamarin.Forms 平台内部使用。For internal use by the Xamarin.Forms platform.

(继承自 Element)

获取或设置本地资源字典。Gets or sets the local resource dictionary.

(继承自 VisualElement)

获取或设置呈现元素时围绕 Z 轴的旋转(仿射旋转)。Gets or sets the rotation about the Z-axis (affine rotation) when the element is rendered.

(继承自 VisualElement)

获取或设置呈现元素时围绕 X 轴的旋转(透视旋转)。Gets or sets the rotation about the X-axis (perspective rotation) when the element is rendered.

(继承自 VisualElement)

获取或设置呈现元素时围绕 Y 轴的旋转(透视旋转)。Gets or sets the rotation about the Y-axis (perspective rotation) when the element is rendered.

(继承自 VisualElement)

获取或设置应用于元素的比例因子。Gets or sets the scale factor applied to the element.

(继承自 VisualElement)

获取或设置要应用于 X 方向的缩放值。Gets or sets a scale value to apply to the X direction.

(继承自 VisualElement)

获取或设置要应用于 Y 方向的缩放值。Gets or sets a scale value to apply to the Y direction.

(继承自 VisualElement)

获取或设置用于唯一地标识元素的用户定义的值。Gets or sets a user defined value to uniquely identify the element.

(继承自 Element)

获取或设置元素的 X 转换增量。Gets or sets the X translation delta of the element.

(继承自 VisualElement)

获取或设置元素的 Y 转换增量。Gets or sets the Y translation delta of the element.

(继承自 VisualElement)

获取与此元素关联的 Trigger 列表。Gets the list of Trigger associated to this element. 这是一种可绑定属性。This is a bindable property.

(继承自 VisualElement)

获取或设置 LayoutOptions,它定义元素在布局周期中的布局方式。Gets or sets the LayoutOptions that define how the element gets laid in a layout cycle. 这是一种可绑定属性。This is a bindable property.

(继承自 View)

获取此元素的当前呈现宽度。Gets the current rendered width of this element. 这是一种只读可绑定属性。This is a read-only bindable property.

(继承自 VisualElement)

获取或设置此元素的所需宽度替代。Gets or sets the desired width override of this element.

(继承自 VisualElement)

获取此元素的当前 X 位置。Gets the current X position of this element. 这是一种只读可绑定属性。This is a read-only bindable property.

(继承自 VisualElement)

获取此元素的当前 Y 位置。Gets the current Y position of this element. 这是一种只读可绑定属性。This is a read-only bindable property.

(继承自 VisualElement)

方法

表示开始对元素属性进行批更改。Signals the start of a batch of changes to the elements properties.

(继承自 VisualElement)

表示元素命令批处理结束,且现在应提交命令。Signals the end of a batch of commands to the element and that those commands should now be committed.

(继承自 VisualElement)

供 Xamarin.Forms 平台内部使用。For internal use by the Xamarin.Forms platform.

(继承自 VisualElement)

清除由 SetValue 为 property 设置的任何值。Clears any value set by SetValue for property.

(继承自 BindableObject)

清除由 SetValue 为 propertyKey 标识的属性设置的任何值。Clears any value set by SetValue for the property that is identified by propertyKey.

(继承自 BindableObject)

供 Xamarin.Forms 平台内部使用。For internal use by the Xamarin.Forms platform.

(继承自 Element)

供 Xamarin.Forms 平台内部使用。For internal use by the Xamarin.Forms platform.

(继承自 Element)

返回具有指定名称的元素。Returns the element that has the specified name.

(继承自 Element)

尝试将焦点设定到此元素上。Attemps to set focus to this element.

(继承自 VisualElement)

返回在指定的 point 下可见的子元素。Returns the child elements that are visually beneath the specified point.

(继承自 View)

已过时。

Returns the SizeRequest of the element. 调用此方法开始布局循环的测量过程。Calling this method begins the measure pass of a layout cycle.

(继承自 VisualElement)

返回 BindableProperty 中包含的值。Returns the value that is contained in the BindableProperty.

(继承自 BindableObject)

已过时。

供 Xamarin.Forms 平台内部使用。For internal use by the Xamarin.Forms platform.

(继承自 BindableObject)

已过时。

供 Xamarin.Forms 平台内部使用。For internal use by the Xamarin.Forms platform.

(继承自 BindableObject)

调用此方法以使此 VisualElement 的布局无效。Method that is called to invalidate the layout of this VisualElement.

(继承自 VisualElement)

供 Xamarin.Forms 平台内部使用。For internal use by the Xamarin.Forms platform.

(继承自 VisualElement)

如果目标属性存在并且已设置,则返回 true。Returns true if the target property exists and has been set.

(继承自 BindableObject)

在布局循环中更新元素的边界。Updates the bounds of the element during the layout cycle.

(继承自 VisualElement)

返回在设备上显示可视元素所需的最小大小。Returns the minimum size that a visual element needs in order to be displayed on the device.

(继承自 VisualElement)

供 Xamarin.Forms 平台内部使用。For internal use by the Xamarin.Forms platform.

(继承自 VisualElement)

返回此 BoxView 的特定于平台的实例,可对其调用特定于平台的方法。Returns the platform-specific instance of this BoxView, on which a platform-specific method may be called.

每当 View 的绑定上下文发生更改时就会调用。Invoked whenever the binding context of the View changes. 重写此方法可为此事件添加类处理。Override this method to add class handling for this event.

(继承自 View)

应用程序开发者可以重写此方法以在添加子级时进行响应。Application developers can override this method to respond when a child is added.

(继承自 VisualElement)

应用程序开发者可以重写此方法以在删除子级时进行响应。Application developers can override this method to respond when a child is removed.

(继承自 VisualElement)

Invoked whenever the ChildrenReordered event is about to be emitted. 实现此方法可为此事件添加类处理。Implement this method to add class handling for this event.

(继承自 VisualElement)

进行布局测量时调用的方法。Method that is called when a layout measurement happens.

(继承自 VisualElement)

更改绑定属性时调用的方法。Method that is called when a bound property is changed.

(继承自 Element)

从子类调用此方法以通知属性将要发生更改。Call this method from a child class to notify that a change is going to happen on a property.

(继承自 BindableObject)

在布局循环过程中设置元素的大小时调用此方法。This method is called when the size of the element is set during a layout cycle. 在发出 SizeChanged 事件之前直接调用此方法。This method is called directly before the SizeChanged event is emitted. 实现此方法可为此事件添加类处理。Implement this method to add class handling for this event.

(继承自 VisualElement)

已过时。

对盒视图提出大小请求时调用的方法。Method that is called when a size request is made to the box view.

删除先前设置的绑定。Removes a previously set binding.

(继承自 BindableObject)

移除先前设置的动态资源Removes a previously set dynamic resource

(继承自 Element)

将此元素的 BindableProperty 属性设置为通过 DynamicResource 使用提供的键来更新。Sets the BindableProperty property of this element to be updated via the DynamicResource with the provided key.

(继承自 Element)

设置指定属性的值。Sets the value of the specified property.

(继承自 BindableObject)

设置 propertyKey 的值。Sets the value of the propertyKey.

(继承自 BindableObject)

供 Xamarin.Forms 平台内部使用。For internal use by the Xamarin.Forms platform.

(继承自 BindableObject)

供 Xamarin.Forms 平台内部使用。For internal use by the Xamarin.Forms platform.

(继承自 Element)

供 Xamarin.Forms 平台内部使用。For internal use by the Xamarin.Forms platform.

(继承自 Element)

在布局循环过程中调用 SizeAllocated 以指示子树布局的开始。SizeAllocated is called during a layout cycle to signal the start of a sub-tree layout.

(继承自 VisualElement)

不应用所有以前设置的绑定。Unapplies all previously set bindings.

(继承自 BindableObject)

取消设置此元素的焦点。Unsets focus to this element.

(继承自 VisualElement)

事件

供 Xamarin.Forms 平台内部使用。For internal use by the Xamarin.Forms platform.

(继承自 VisualElement)

每当将子元素添加到元素时就会发生。Occurs whenever a child element is added to the element.

(继承自 Element)

每当从元素中删除子元素时就会发生。Occurs whenever a child element is removed from the element.

(继承自 Element)

重新排序 VisualElement 的子级时发生。Occurs when the Children of a VisualElement have been re-ordered.

(继承自 VisualElement)

每当将子元素添加到元素子树时就会发生。Occurs whenever a child element is added to the elements subtree.

(继承自 Element)

每当从元素子树中删除子元素时就会发生。Occurs whenever a child element is removed from the elements subtree.

(继承自 Element)

供 Xamarin.Forms 平台内部使用。For internal use by the Xamarin.Forms platform.

(继承自 VisualElement)

元素接收焦点时发生。Occurs when the element receives focus.

(继承自 VisualElement)

可视元素的布局无效时引发的事件。Event that is raised when the layout of a visual element is invalidated.

(继承自 VisualElement)

在属性已更改时引发。Raised when a property has changed.

(继承自 BindableObject)

在属性将要更改时引发。Raised when a property is about to change.

(继承自 BindableObject)

当此元素上的 Width 或 Height 属性的值发生更改时发生。Occurs when either the Width or the Height properties change value on this element.

(继承自 VisualElement)

当元素丢失焦点时发生。Occurs when the element loses focus.

(继承自 VisualElement)

显式接口实现

供 Xamarin.Forms 平台内部使用。For internal use by the Xamarin.Forms platform.

(继承自 Element)

供 Xamarin.Forms 平台内部使用。For internal use by the Xamarin.Forms platform.

(继承自 View)

获取平台上元素的有效可视流方向,考虑区域设置和逻辑流设置。Gets the effective visual flow direction for the element on the platform, taking into account the locale and logical flow settings.

(继承自 VisualElement)

扩展方法

返回一个布尔值,该值指示 handle 指定的动画是否正在运行。Returns a Boolean value that indicates whether or not the animation that is specified by handle is running.

返回包含 element 的作用域中名称为 name 的类型 T 的实例。Returns the instance of type T that has name name in the scope that includes element.

返回一个任务,它执行 opacity、length 和 easing 参数描述的淡化。Returns a task that performs the fade that is described by the opacity, length, and easing parameters.

返回一个任务,它将 view 指定的 VisualElement 的边界简化为 bounds 参数指定的矩形。Returns a task that eases the bounds of the VisualElement that is specified by the view to the rectangle that is specified by the bounds parameter.

从当前旋转将 view 指定的 VisualElement 旋转为 drotation。Rotates the VisualElement that is specified by view from its current rotation by drotation.

返回一个任务,它将 view 指定的 VisualElement 从其当前比例缩放到 dscale。Returns a task that scales the VisualElement that is specified by view from its current scale to dscale.

返回一个任务,它执行 rotation、length 和 easing 参数描述的旋转。Returns a task that performs the rotation that is described by the rotation, length, and easing parameters.

返回将 Y 轴倾斜 opacity 的任务,花费时间 length 并使用 easing。Returns a task that skews the Y axis by opacity, taking time length and using easing.

返回将 X 轴倾斜 opacity 的任务,花费时间 length 并使用 easing。Returns a task that skews the X axis by opacity, taking time length and using easing.

返回一个任务,它将 view 指定的 VisualElement 缩放到绝对比例因子 scale。Returns a task that scales the VisualElement that is specified by view to the absolute scale factor scale.

将元素 TranslationX 和 TranslationY 属性从其当前值动画处理为新的值。Animates an elements TranslationX and TranslationY properties from their current values to the new values. 这可确保输入布局与视觉对象布局处于同一位置。This ensures that the input layout is in the same position as the visual layout.

如果 element 具有与之关联的一个或多个可视状态组,则返回 true。Returns true if element has one or more visual state groups associated with it. 否则返回 false。Otherwise, returns false.

适用于

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值