views:

170

answers:

0

I'm using the DataRepeater control from the Visual Basic Power Pack in my C# Winforms application. The control is unbound, operating in VirtualMode.

I'm displaying multiple items in this control. Depending on certain criteria, I want to disable a button in the control.

I've tried the following in the _DrawItem event of the data repeater:

private void dataXYZ_DrawItem(object sender, DataRepeaterItemEventArgs e)
{
    int Item=e.DataRepeaterItem.ItemIndex;
    dataXYZ.CurrentItem.Controls["buttonSomething"].Enabled = SomeFunc(Item);
}

What happens is the button is enabled or disabled based on what the last item in the control should be.

Any idea how I can control enable state on an item by item basis?

Thanks