如果从同一列表视图中选择其他项目,如何更改列表视图中所选项目的颜色并重置原始颜色。 [英] How to change the color of selected item in the listview and reset the original color if other item is selected from the same listview.

查看:80
本文介绍了如果从同一列表视图中选择其他项目,如何更改列表视图中所选项目的颜色并重置原始颜色。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,


我使用两个listview,一个用于显示特定区域的所有餐厅,另一个用于显示餐厅的菜单。


如果我选择一个 餐厅然后背景颜色应该变成蓝色,所有其他餐厅bcolor是红色的。如果选择任何其他餐厅,则此bcolor应更改为蓝色n所有其他餐厅应更改为红色。

 

< div id =" Cuisine_category"数据双赢控制= QUOT; WinJS.Binding.Template">
< div id =" Category_data" >
< h3 data-win-bind =" innerText:Name" >< / H3>
< / div>
< / div>

< div id =" basicListView_MenuList"数据双赢控制= QUOT; WinJS.UI.ListView" > < / DIV>

我使用此代码显示餐馆名称。


如何以编程方式设置和重置bgcolor。


谢谢,







      


Shilpa Monocept Windows商店应用

解决方案

Hi Shilpa_A_S,


在你采用programmtic方法之前,我建议你看一下可用于自定义windows store ListView控件(及其项目)的样式选项。我们可以使用样式来控制大多数常见的出现行为:






#Styling ListView及其项目(使用JavaScript和HTML的Windows应用商店应用)(Windows)

http://msdn.microsoft.com/en-us/library/windows/apps/hh850406.aspx


Hi everyone,

I m using two listview, one to show all the restaurants in particular area and other to show Menu of the restaurant respectively.

If i select one  restaurant then background color should change to blue, and all other other restaurant bcolor is red. If any other restaurant is selected then this bcolor should change to blue n all other should change to red.

<div id="Cuisine_category" data-win-control="WinJS.Binding.Template"> <div id="Category_data" > <h3 data-win-bind="innerText: Name" ></h3> </div> </div>

<div id="basicListView_MenuList" data-win-control="WinJS.UI.ListView" > </div>

I m using this code to display restaurant name.

How to set and reset bgcolor programmatically.

Thanks,


      

Shilpa Monocept Windows store apps

解决方案

Hi Shilpa_A_S,

Before you going the programmtic approach, I suggest you take a look at the styling options available for customizing windows store ListView control (and its items). We can use style to control most of the common appearnce behaviors:



#Styling the ListView and its items (Windows Store apps using JavaScript and HTML) (Windows)
http://msdn.microsoft.com/en-us/library/windows/apps/hh850406.aspx


这篇关于如果从同一列表视图中选择其他项目,如何更改列表视图中所选项目的颜色并重置原始颜色。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆