| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,20 @@ | |||
| 1 | + Label { | ||
| 2 | + margin: 6; | ||
| 3 | + padding: 4; | ||
| 4 | + } | ||
| 5 | + | ||
| 6 | + .unselected { | ||
| 7 | + border-width: 4; | ||
| 8 | + border-color: gray; | ||
| 9 | + border-radius: 10; | ||
| 10 | + background: white; | ||
| 11 | + color: gray | ||
| 12 | + } | ||
| 13 | + | ||
| 14 | + .selected { | ||
| 15 | + border-width: 4; | ||
| 16 | + border-color: blue; | ||
| 17 | + border-radius: 10; | ||
| 18 | + background: lightcoral; | ||
| 19 | + color: blue; | ||
| 20 | + } | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,21 @@ | |||
| 1 | + import { fromObject } from "tns-core-modules/data/observable"; | ||
| 2 | + | ||
| 3 | + export function loaded(args) { | ||
| 4 | + var items = []; | ||
| 5 | + | ||
| 6 | + for (let i = 0; i < 100; i++) { | ||
| 7 | + items.push(fromObject({ | ||
| 8 | + text: "<" + i + ">", | ||
| 9 | + selected: !!!(i % 5) | ||
| 10 | + })); | ||
| 11 | + } | ||
| 12 | + args.object.bindingContext = { items: items }; | ||
| 13 | + } | ||
| 14 | + | ||
| 15 | + export function toggle(args) { | ||
| 16 | + console.log("toggle : ") | ||
| 17 | + let context = args.object.bindingContext; | ||
| 18 | + console.dir(context); | ||
| 19 | + context.set("selected", !context.selected); | ||
| 20 | + // args.object.requestLayout(); | ||
| 21 | + } | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,15 @@ | |||
| 1 | + <Page loaded="loaded"> | ||
| 2 | + <StackLayout> | ||
| 3 | + <ListView items="{{ items }}"> | ||
| 4 | + <ListView.itemTemplate> | ||
| 5 | + <StackLayout orientation="horizontal" tap="toggle"> | ||
| 6 | + <Label text="{{ text }}" /> | ||
| 7 | + <Label text="marked" visibility="{{ selected ? 'visible' : 'collapse' }}" /> | ||
| 8 | + <Label text="{{ selected ? 'yep' : 'nope' }}" /> | ||
| 9 | + <Label text="test" class="{{ selected ? 'selected' : 'unselected' }}" /> | ||
| 10 | + <Label text="{{ selected ? 'yep' : 'nope' }}" class="{{ selected ? 'selected' : 'unselected' }}" /> | ||
| 11 | + </StackLayout> | ||
| 12 | + </ListView.itemTemplate> | ||
| 13 | + </ListView> | ||
| 14 | + </StackLayout> | ||
| 15 | + </Page> | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -19,6 +19,7 @@ export function loadExamples() { | |||
| 19 | 19 | examples.set("scrolling-and-sizing", "list-view/scrolling-and-sizing"); | |
| 20 | 20 | examples.set("row-height", "list-view/row-height"); | |
| 21 | 21 | examples.set("width-percent", "list-view/width-percent"); | |
| 22 | + examples.set("item-re-layout", "list-view/item-re-layout"); | ||
| 22 | 23 | ||
| 23 | 24 | return examples; | |
| 24 | 25 | } | |
| Back | FazBrowse Home | New Git URL |
0 commit comments