H
h
....or at least it seems like it is, to me.
I have built this custom list control which has list items which are
also custom made controls that consist of textboxes, labels and
buttons.
Structure goes:
Custom List control
|__ Custom List item control (for list rows)
|__ Textboxes, Labels, Buttons...
I want to click on a list item and have it selected. I did that using:
public void AddListItem()
{
...
li.Click += new EventHandler(li_Click);
pnlList.Controls.Add(li);
...
}
private void li_Click(object sender, EventArgs e)
{
if (m_liSelected != null)
m_liSelected.BackgroundEx =
Color.LightPink;
m_liSelected = (ListItemControl)sender;
m_liSelected.BackgroundEx = Color.IndianRed ;
ListItemSelectedEventArgs args = new
ListItemSelectedEventArgs((string)m_liSelected.Amount);
if (ListItemSelected != null)
ListItemSelected (this, args);
} etc.
However, what I WANT TO ADD to this functionality is that when I click
on a text box placed on the List Item, that the row gets selected (as
if I clicked on a ListItem control itself.
So, in case I didn't make myself clear, clicking on a user control
works, but I have no idea how to "transfer" that behavior to controls
on the user control.
Anyone, please help, I'm hitting the wall here.
thanks,
h
I have built this custom list control which has list items which are
also custom made controls that consist of textboxes, labels and
buttons.
Structure goes:
Custom List control
|__ Custom List item control (for list rows)
|__ Textboxes, Labels, Buttons...
I want to click on a list item and have it selected. I did that using:
public void AddListItem()
{
...
li.Click += new EventHandler(li_Click);
pnlList.Controls.Add(li);
...
}
private void li_Click(object sender, EventArgs e)
{
if (m_liSelected != null)
m_liSelected.BackgroundEx =
Color.LightPink;
m_liSelected = (ListItemControl)sender;
m_liSelected.BackgroundEx = Color.IndianRed ;
ListItemSelectedEventArgs args = new
ListItemSelectedEventArgs((string)m_liSelected.Amount);
if (ListItemSelected != null)
ListItemSelected (this, args);
} etc.
However, what I WANT TO ADD to this functionality is that when I click
on a text box placed on the List Item, that the row gets selected (as
if I clicked on a ListItem control itself.
So, in case I didn't make myself clear, clicking on a user control
works, but I have no idea how to "transfer" that behavior to controls
on the user control.
Anyone, please help, I'm hitting the wall here.
thanks,
h