Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions apps/app/ui-tests-app/css/background-image.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.testBtn {
background-image: url("res://icon");
background-repeat: no-repeat;
color: black;
}
29 changes: 29 additions & 0 deletions apps/app/ui-tests-app/css/background-image.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<Page>
<GridLayout rows="*,*,*,*,*,*" >
<Button backgroundImage="url('~/ui-tests-app/resources/images/no-image.png')"
borderRadius='125' borderWidth='2' borderColor='black'
backgroundRepeat="repeat" backgroundSize="contain"
/>
<Button row="1" backgroundImage="url('~/ui-tests-app/resources/images/no-image.png')"
borderRadius='5' borderWidth='2' borderColor='black'
backgroundRepeat="repeat-y"
/>
<Button row="2" backgroundImage="url('~/ui-tests-app/resources/images/no-image.png')"
borderRadius='25' borderWidth='2' borderColor='black'
backgroundRepeat="repeat-x"
/>
<Button row="3" backgroundImage="url('res://icon')"
borderRadius='10' borderWidth='2' borderColor='black'
backgroundRepeat="no-repeat"
backgroundSize="contain"
height="80" width="180"
/>
<Button row="4" text="css background no-repeat" class="testBtn"/>
<Button row="5" backgroundImage="url('res://icon')"
borderRadius='10' borderWidth='2' borderColor='black'
style="background-repeat: no-repeat"
backgroundSize="contain"
height="80" width="180"
/>
</GridLayout>
</Page>
1 change: 1 addition & 0 deletions apps/app/ui-tests-app/css/main-page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,6 @@ export function loadExamples() {
examples.set("missing-background-image", "css/missing-background-image");
examples.set("background-shorthand", "css/background-shorthand");
examples.set("background-image-linear-gradient", "css/background-image-linear-gradient");
examples.set("background-image", "css/background-image");
return examples;
}
22 changes: 22 additions & 0 deletions tns-core-modules/ui/core/view/view-common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import {
import { createViewFromEntry } from "../../builder";
import { StyleScope } from "../../styling/style-scope";
import { LinearGradient } from "../../styling/linear-gradient";
import { BackgroundRepeat } from "../../styling/style-properties";

export * from "../../styling/style-properties";
export * from "../view-base";
Expand Down Expand Up @@ -472,6 +473,27 @@ export abstract class ViewCommon extends ViewBase implements ViewDefinition {
this.style.backgroundImage = value;
}

get backgroundSize(): string {
return this.style.backgroundSize;
}
set backgroundSize(value: string) {
this.style.backgroundSize = value;
}

get backgroundPosition(): string {
return this.style.backgroundPosition;
}
set backgroundPosition(value: string) {
this.style.backgroundPosition = value;
}

get backgroundRepeat(): BackgroundRepeat {
return this.style.backgroundRepeat;
}
set backgroundRepeat(value: BackgroundRepeat) {
this.style.backgroundRepeat = value;
}

get minWidth(): Length {
return this.style.minWidth;
}
Expand Down