首页 > 代码库 > 通过 listboxitem 查找属于listbox第几条数据

通过 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 = http://www.mamicode.com/true;
            }
            else
            {
                citem.IsOddIndex = false;
               // IsOddIndex.Value = http://www.mamicode.com/false;
            }
            return ContainerStyle1;
        }

 

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