How can I change opacity of first listview element?

跟風遠走 提交于 2020-01-25 05:53:06

问题


im trying to change opacity of first ListView element, but i am not getting the right way to implemet it ; Can you please give some suggestions ?

display.Opacity = 0.5;
                foreach (Common trigger in display.Items)
                {
                    if (trigger.Image_Name == "First")
                    {
                        trigger.Opacity = 1;
                    }
                }

where display is my ListView


回答1:


When you change the opacity property of ListView it does not affect to it's items separately(opacity changes for ListView as a whole). If you want to set all items opacity to 0.5 except one, try to do something like this

for(int i=1; i<display.Items.Count;i++)
  display.Items[i].Opacity = 0.5;


来源:https://stackoverflow.com/questions/17993912/how-can-i-change-opacity-of-first-listview-element

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!