Control
Wisej.Web.Control
Namespace: Wisej.Web
Assembly: Wisej.Framework (3.1.0.0)
Base class for all Wisej controls.
C#
VB.NET
public class Control : IWisejControl, IWisejComponent, IBindableComponent, IWisejSerializable, IHasPropertyStore, IHasResponsiveProfiles
Public Class Control
Inherits IWisejControl
Implements IWisejComponent, IBindableComponent, IWisejSerializable, IHasPropertyStore, IHasResponsiveProfiles
String: Returns or sets the description that will be reported to accessibility client applications. It is assigned to the "alt" attribute of the browser element. (Default:
null
)String: Returns or sets the name of the control for use by accessibility client applications. It is assigned to the "name" attribute of the browser element. (Default:
null
)AccessibleRole: Returns or sets the accessible role of the control that will be reported to accessibility client applications. It is assigned to the "role" attribute of the browser element. (Default:
Default
)Boolean: Returns or sets whether the control can accept data that the user drags onto it. (Default:
False
)AnchorStyles: Returns or sets the edges of the container to which a control is bound and determines how a control is resized with its parent. (Default:
Top, Left
)Boolean: Returns or sets whether the control receives pointer events. Anonymous controls let pointer events bubble to their parents. (Default:
False
)ImageLayout: Returns or sets the background image layout as defined in the ImageLayout enumeration. (Default:
None
)Int32: Returns the distance, in pixels, between the bottom edge of the control and the top edge of its container's client area.
Rectangle: Returns or sets the size and location of the control including its non-client area, in pixels and relative to the parent control.
Boolean: Returns or sets whether the control causes validation to be performed on controls that require to be validated when this control receives focus. (Default:
True
)ClientEventCollection: Returns a collection of client events and JavaScript listeners. You may attach multiple listeners to same event.
You can use this collection at design time or in code or through the listener methods:
Use this property to add or remove custom CSS classes that you may add to your application as standard css files or through the StyleSheet extender. You can assign multiple class names separated by a space and you can manage this property using the related methods:
You can use any CSS style string.
// set the border radius to 100% and make the control round.
this.button1.CssStyle = "border-radius:100%";
Cursor: Returns or sets the cursor that is displayed when the mouse pointer is over the control. (Default:
null
)DockStyle: Returns or sets which control borders are docked to its parent control and determines how a control is resized with its parent. (Default:
None
)Boolean: Check if the control defines any responsive profile without forcing the creation of the collection.
String: Returns or sets an initialization script to execute when the widget is created (or reloaded) in the browser.
// change the background color of the internal label of the button widget.
this.button1.InitScript = "this.getChildControl('label').setBackgroundColor('red')";
// attach a JavaScript event handler.
this.textBox1.InitScript = @"this.addListener('keydown', function(e) {
if (e.getKeyIdentifier() == "PageDown") {
alert('You pressed PageDown.');
}
});
You may also use the init script to attach events to the widget or to its internal children. Event handlers can also be attached using the ClientEvents collection and the client events methods:
Boolean: Returns true when this control belogs to a session different than the currently executing thread.
Int32: Returns or sets the distance, in pixels, between the left edge of the control and the left edge of its container's client area.
Point: Returns or sets the coordinates of the upper-left corner of the control relative to the upper-left corner of its container.
Keys: Returns a value indicating which of the modifier keys (SHIFT, CTRL, and ALT) is in a pressed state.
ResponsiveProfileCollection: Returns the collection of responsive properties that have been set for this control.
Int32: Return the distance, in pixels, between the right edge of the control and the left edge of its container's client area.
RightToLeft: Returns or sets whether the control's elements are aligned right-to-left to support RTL languages.
The behavior of this property is configurable in Default.json setting the "rightToLeft" property to "true", "false", or "auto". The default is "auto", causing the value to be retrieved from the current language.
Boolean: Returns or sets whether the text in the control can be selected in the browser by the user by dragging the pointer. [Since 2.5.22] (Default:
False
)Not to be confused with Selectable, which corresponds to the Focusable property. When Selectable is set to true, the text of the control (i.e. a label or a button) can be highlighted in the browser and copied to the clipboard. It will also make the widget "focusable" but only in the browser.
Use this property to manage additional custom states that you may want to add to a widget. The state will update the visualization of the widget using the styles and properties set in the current theme and loaded theme mixins. You can also force the usage of built-in states. However, this property will not return the current states of the widget as updated by the client browser. It only returns the states set by the application.
// force the widget to update the UI as if it was hovered and focused.
this.button1.States = new [] { "hovered", "focused" };
// apply a custom state defined in a custom theme or theme mixing.
this.panel1.States = new [] { "alert" };
In addition to setting this property directly, you can also manage it using the related methods:
When AllowHtml is set to true, the text can contain HTML content. If the text contains new lines (CRLF) but doesn't contain HTML elements (at least one "<") all CRLF are automatically substituted with "<BR/>".
When using ToolTipText property you can only set the ToolTip text and cannot change the default ToolTip icon set in the theme. To change the ToolTip icon you can either create a custom theme, or a theme mixin, or use the ToolTip extender and the ToolTipText property added by the extender. You can change the default ForeColor, AutomaticDelay, InitialDelay, AutoPopDelay, or enable HTML in ToolTipText by using a ToolTip extender also without setting the ToolTipText property added by the extender.
Int32: Returns or sets the distance, in pixels, between the top edge of the control and the top edge of its container's client area.
Object: Returns a dynamic object that can be used to store custom data in relation to this control.
Boolean: Returns or sets whether to use the wait cursor for the current control and all child controls. (Default:
False
)Adds a new listener script to the event name to the client widget.
Returns: Int32. An integer id that you can use to remove the listener from the event using RemoveClientEventListener or to retrieve the listener script code using GetClientEventListener.
The script will execute in the browser when the event name occurs. You can attach multiple listeners to the same event.
Adds the CSS class name to the widget element. If the class already exists in the CssClass it's not added.
Parameter | Type | Description |
---|---|---|
name | Name of the css class to add. |
Adds the specified theme state to the widget.
Parameter | Type | Description |
---|---|---|
state | Name of the custom state to add to the widget. |
Executes the specified delegate asynchronously, in the context of the session that owns the control.
Parameter | Type | Description |
---|---|---|
method | A delegate to a method that takes no parameters. |
Executes the specified delegate asynchronously, in the context of the session that owns the control, with the specified list of arguments.
Brings the control to the front of the z-order.
Runs the JavaScript function within the component's context in the browser.
Runs the JavaScript function within the component's context in the browser and returns the value to the callback method.
Parameter | Type | Description |
---|---|---|
function | The name of the JavaScript function to execute. | |
callback | Asynchronous callback method that receives the return value. | |
args | The arguments to pass to the function. |
Asynchronously runs the JavaScript function within the component's context in the browser and returns an awaitable Task containing the value returned by the remote call.
Centers the position of the control within the bounds of the parent.
Centers the position of the control within the bounds of the parent either horizontally, vertically or both.
Indicates whether the specified control is a child of this control.
Creates and register this control and all its children.
Begins a drag-and-drop operation.
Parameter | Type | Description |
---|---|---|
data | The data to drag. | |
allowedEffects |
Returns: DragDropEffects. A value from the DragDropEffects enumeration that represents the final effect that was performed during the drag-and-drop operation.
Begins a drag-and-drop operation.
Parameter | Type | Description |
---|---|---|
data | The data to drag. | |
allowedEffects | ||
imageSource | The name or URL for an image to use as the drag cursor. |
Returns: DragDropEffects. A value from the DragDropEffects enumeration that represents the final effect that was performed during the drag-and-drop operation.
Begins a drag-and-drop operation.
Parameter | Type | Description |
---|---|---|
data | The data to drag. | |
allowedEffects | ||
imageSource | The name or URL for an image to use as the drag cursor. | |
imageSize | The size of the drag image specified in
imageSource. |