Frobit setting inline style from code

This commit is contained in:
vakrilov
2015-07-07 14:40:58 +03:00
parent c5748bf73b
commit f3979136a4
10 changed files with 130 additions and 108 deletions

View File

@@ -389,7 +389,7 @@ export class View extends proxy.ProxyObject implements definition.View {
return this._style;
}
set style(value) {
this._applyInlineStyle(value);
throw new Error("View.style property is read-only.");
}
get isLayoutValid(): boolean {
@@ -763,7 +763,6 @@ export class View extends proxy.ProxyObject implements definition.View {
if (types.isString(inlineStyle)) {
try {
this.style._beginUpdate();
this.style._resetLocalValues();
styleScope.applyInlineSyle(this, <string>inlineStyle);
} finally {
this.style._endUpdate();
@@ -942,6 +941,15 @@ export class View extends proxy.ProxyObject implements definition.View {
this._requestedVisualState = state;
}
public _applyXmlAttribute(attribute, value): boolean {
if (attribute === "style") {
this._applyInlineStyle(value);
return true;
}
return false;
}
public _updateLayout() {
// needed for iOS.
}

6
ui/core/view.d.ts vendored
View File

@@ -94,7 +94,7 @@ declare module "ui/core/view" {
* This class is the base class for all UI components.
* A View occupies a rectangular area on the screen and is responsible for drawing and layouting of all UI components within.
*/
export class View extends proxy.ProxyObject {
export class View extends proxy.ProxyObject implements ApplyXmlAttributes {
/**
* Gets or sets the corner radius of the view.
*/
@@ -441,6 +441,8 @@ declare module "ui/core/view" {
_updateLayout(): void;
_applyXmlAttribute(attribute, value): boolean;
/**
* Called my measure method to cache measureSpecs.
*/
@@ -515,6 +517,6 @@ declare module "ui/core/view" {
* @param attrValue - the value of the attribute (bold)
* Should return true if this attribute is handled and there is no need default handler to process it.
*/
applyXmlAttribute(attributeName: string, attrValue: any): boolean;
_applyXmlAttribute(attributeName: string, attrValue: any): boolean;
}
}