Hi,
Please modify your variable "IsSelected" and "TheText" to become Properties.
Here's your sample, slightly modified, in C#
Please modify your variable "IsSelected" and "TheText" to become Properties.
Here's your sample, slightly modified, in C#
public partial class MainWindow : Window
{
private static List<string> MatlList = new List<string>()
{
"first", "second", "third", "fourth"
};
public MainWindow()
{
InitializeComponent();
this.lbMatlList.Items.Clear();
int iMatls = 0;
for( int iNum = 1; iNum <= MatlList.Count; iNum++ )
{
string tString = MatlList[ iNum - 1 ];
// Check whether this entry should be checked
bool Used = true; //ContainsLabel( tString, SelMatlList );
this.lbMatlList.Items.Add( new Used_Material( Used, tString ) );
//Used_Material MatlItem = this.lbMatlList.Items( iMatls );
iMatls += 1;
}
}
}
public class Used_Material
{
public bool IsSelected
{
get;
set;
}
public string TheText
{
get;
set;
}
public Used_Material( bool tmpUsed, string tmpName )
{
IsSelected = tmpUsed;
TheText = tmpName;
}
}