通过 listboxitem 查找属于listbox第几条数据

Posted 莫欺

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了通过 listboxitem 查找属于listbox第几条数据相关的知识,希望对你有一定的参考价值。

 public override System.Windows.Style SelectStyle(object item, System.Windows.DependencyObject container)
        {
            if (ContainerStyle1 == null)
                return null;
            TCheckListBoxItem citem = container as TCheckListBoxItem;
            TCheckListBox listView = ItemsControl.ItemsControlFromItemContainer(container) as TCheckListBox;
            int index =listView.ItemContainerGenerator.IndexFromContainer(container);
            if (index % 2 == 0)
            {
                citem.IsOddIndex = true;
                //IsOddIndex.Value = true;
            }
            else
            {
                citem.IsOddIndex = false;
               // IsOddIndex.Value = false;
            }
            return ContainerStyle1;
        }

 

以上是关于通过 listboxitem 查找属于listbox第几条数据的主要内容,如果未能解决你的问题,请参考以下文章