I am an old time user of the Array of controls in VB back in the days. It is gone now, so I am looking for a replacement.
I have created an User Control in C# for Silverlight. This control exposes a bool property IsChecked.
<ImageButton Name"imgbutton1" IsChecked="True"/>
<ImageButton Name"imgbutton2" IsChecked="False"/>
<ImageButton Name"imgbutton3" IsChecked="False"/>
In a Child Window, I populate a series of these controls and use them as an equivalent of RadioButtons, i.e., when I click one, any other that has an IsChecked = true will be set to false, for which I thought of doing something like:
List<ImageButton> imgButtons= new List<ImageButton>();
imgButtons.Add(imgbutton1);
imgButtons.Add(imgbutton2);
imgButtons.Add(imgbutton3);
Then, to clear all of their IsChecked but the one I need (pointed by some 'index' variable), I would do something like:
foreach (ImageButton imgbutton in imgButtons) imgbutton.IsChecked = false;
imgbuttons[index].IsChecked = true;
The problem I have is that List<ImageButton> is not compiling. I am very flaky at collections and can't figure out what I am missing. I can do for standard controls but doesn't allow me to get a user control in there.
Thanks!
PS: I have thought of just customizing a RadioButton control but don't have Blend and I am using this image control for other types of controls. However, if you think there is a better way to implement this, please let me know.
EDIT: Compiler says "The type or namespace name 'ImageButton' could not be found (are you missing a using directive or an assembly reference?)'