old post
Yes, of course you can customize everything. I think that your rendering problem occurs because of this, you can forget forceLayout.
ready: function (element, options) {
element.querySelector("#listView").winControl.forceLayout();
}
I do not have my Windows 8 next to me, so if no one else answers and the problem arose not from forceLayout. I will update the answer for the night.
I hope this help.
Good, so I misunderstood your problem before.
Here is something that should satisfy you.
, JavaScript CSS.
, JavaScript, , Grid Application, . 4.js .
function MyCellSpanningJSTemplate(itemPromise) {
return itemPromise.then(function (currentItem) {
var result = document.createElement("div");
result.className = currentItem.data.type;
result.style.overflow = "hidden";
var image = document.createElement("img");
image.className = "regularListIconTextItem-Image";
image.src = currentItem.data.picture;
result.appendChild(image);
var body = document.createElement("div");
body.className = "regularListIconTextItem-Detail";
body.style.overflow = "hidden";
result.appendChild(body);
var title = document.createElement("h4");
title.innerText = currentItem.data.title;
body.appendChild(title);
var fulltext = document.createElement("h6");
fulltext.innerText = currentItem.data.text;
body.appendChild(fulltext);
return result;
});
}
var appViewState = Windows.UI.ViewManagement.ApplicationViewState;
var appView = Windows.UI.ViewManagement.ApplicationView;
var ui = WinJS.UI;
(function () {
"use strict";
var page = WinJS.UI.Pages.define("/html/scenario4.html", {
initializeLayout: function (listView, viewState) {
if (viewState === appViewState.snapped) {
listView.layout = new ui.ListLayout();
}
else {
listView.layout = new ui.GridLayout({ groupInfo: groupInfo });
}
},
ready: function (element, options) {
var listView = element.querySelector("#listView").winControl;
this.initializeLayout(listView, appView.value);
},
updateLayout: function (element, viewState, lastViewState) {
var listView = element.querySelector("#listView").winControl;
if (lastViewState !== viewState) {
if (lastViewState === appViewState.snapped || viewState === appViewState.snapped) {
this.initializeLayout(listView, viewState);
}
else {
listView.layout = new ui.GridLayout({ groupInfo: groupInfo });
}
}
}
});
})();
layout script4.html, 4.js
, , . (Btw , , ).
script4.css , CSS 3 -, .
snapped . 4.css
@media screen and (-ms-view-state: snapped) {
#listView {
max-width: 260px;
height: 280px;
border: solid 2px rgba(0, 0, 0, 0.13);
}
.regularListIconTextItem {
max-width: 250px;
max-height: 70px;
padding: 5px;
overflow: hidden;
display: -ms-grid;
}
.smallListIconTextItem {
max-width: 250px;
max-height: 70px;
padding: 5px;
overflow: hidden;
background-color: Pink;
display: -ms-grid;
}
.mediumListIconTextItem {
max-width: 250px;
max-height: 70px;
padding: 5px;
overflow: hidden;
background-color: LightGreen;
display: -ms-grid;
}
.largeListIconTextItem {
max-width: 250px;
max-height: 70px;
padding: 5px;
overflow: hidden;
background-color: LightBlue;
display: -ms-grid;
}
}
, ;)