diff --git a/apps/tests/xml-declaration/xml-declaration-tests.ts b/apps/tests/xml-declaration/xml-declaration-tests.ts index 563f874d9..1c0c60f0a 100644 --- a/apps/tests/xml-declaration/xml-declaration-tests.ts +++ b/apps/tests/xml-declaration/xml-declaration-tests.ts @@ -203,6 +203,17 @@ export function test_parse_ShouldParseSubProperties() { TKUnit.assert(sw.visibility === "collapsed", "Expected result: collapsed; Actual result: " + sw.visibility + "; type: " + typeof (sw.visibility)); }; +export function test_parse_CanBindBackgroundImage() { + var p = builder.parse(""); + var expected = "~/logo.png" + var obj = new observable.Observable(); + obj.set("myProp", expected); + p.bindingContext = obj; + var sw = p.content; + + TKUnit.assert(sw.backgroundImage === expected, "Expected result: " + expected + "; Actual result: " + sw.backgroundImage); +}; + export function test_parse_ShouldParseCustomComponentWithoutXml() { var p = builder.parse(''); var ctrl = p.content; diff --git a/ui/core/view-common.ts b/ui/core/view-common.ts index 2d5c0fc63..e67a36eb8 100644 --- a/ui/core/view-common.ts +++ b/ui/core/view-common.ts @@ -77,25 +77,25 @@ function onCssClassPropertyChanged(data: dependencyObservable.PropertyChangeData } } - var idProperty = new dependencyObservable.Property( +var idProperty = new dependencyObservable.Property( "id", "View", new proxy.PropertyMetadata(undefined, dependencyObservable.PropertyMetadataSettings.AffectsStyle) ); - var cssClassProperty = new dependencyObservable.Property( +var cssClassProperty = new dependencyObservable.Property( "cssClass", "View", new proxy.PropertyMetadata(undefined, dependencyObservable.PropertyMetadataSettings.AffectsStyle, onCssClassPropertyChanged) ); - var isEnabledProperty = new dependencyObservable.Property( +var isEnabledProperty = new dependencyObservable.Property( "isEnabled", "View", new proxy.PropertyMetadata(true) ); - var isUserInteractionEnabledProperty = new dependencyObservable.Property( +var isUserInteractionEnabledProperty = new dependencyObservable.Property( "isUserInteractionEnabled", "View", new proxy.PropertyMetadata(true) @@ -202,6 +202,13 @@ export class View extends proxy.ProxyObject implements definition.View { this.style.backgroundColor = value; } + get backgroundImage(): string { + return this.style.backgroundImage; + } + set backgroundImage(value: string) { + this.style.backgroundImage = value; + } + get minWidth(): number { return this.style.minWidth; } @@ -299,7 +306,7 @@ export class View extends proxy.ProxyObject implements definition.View { set paddingBottom(value: number) { this.style.paddingBottom = value; } - + get horizontalAlignment(): string { return this.style.horizontalAlignment; } diff --git a/ui/core/view.d.ts b/ui/core/view.d.ts index 8d792bc4e..83d059f9c 100644 --- a/ui/core/view.d.ts +++ b/ui/core/view.d.ts @@ -138,7 +138,12 @@ declare module "ui/core/view" { * Gets or sets the background color of the view. */ backgroundColor: color.Color; - + + /** + * Gets or sets the background image of the view. + */ + backgroundImage: string; + /** * Gets or sets the minimum width the view may grow to. */