Hi,
Please refer to the code as follow:
// Generate Search Pane suggestion from XML mark up for a single suggestion.
function addSuggestionFromNode(node, suggestions) {
if (node.nodeName !== "Item") {
return null;
}
var text, description, url, imageUrl, imageAlt;
// Obtain suggestion values
for (var i = 0; i < node.childNodes.length; i++) {
switch (node.childNodes[i].nodeName) {
case "Text":
text = node.childNodes[i].textContent;
break;
case "Description":
description = node.childNodes[i].textContent;
break;
case "Url":
url = node.childNodes[i].textContent;
break;
case "Image":
if (node.childNodes[i].attributes.getNamedItem("source")) {
imageUrl = node.childNodes[i].attributes.getNamedItem("source").value;
}
if (node.childNodes[i].attributes.getNamedItem("alt")) {
imageAlt = node.childNodes[i].attributes.getNamedItem("alt").value;
}
break;
}
}
if (!description) {
description = "";
}
if (!text || text === "") {
// No proper suggestion item exists
} else if (!url) {
suggestions.appendQuerySuggestion(text);
} else {
var imageUri;
if (imageUrl || imageUrl === "") {
// We require an image for result suggestions.
imageUri = new Windows.Foundation.Uri(imageUrl);
} else {
// The following image should not be used in your application for Result Suggestions. Replace the image with one that is tailored to your content.
imageUri = new Windows.Foundation.Uri("ms-appx:///Images/SDK_ResultSuggestionImage.png");
}
if (imageUri) {
var imageSource = Windows.Storage.Streams.RandomAccessStreamReference.createFromUri(imageUri);
suggestions.appendResultSuggestion(text, description, url, imageSource, imageAlt);
}
}
return;
}
#SearchSuggestionCollection.AppendResultSuggestion | appendResultSuggestion method (Windows)
http://msdn.microsoft.com/en-US/library/windows/apps/hh700542
Roy
MSDN Community Support | Feedback to us
Develop and promote your apps in Windows Store
Please remember to mark the replies as answers if they help and unmark them if they provide no help.