Quantcast
Channel: wpftoolkit Discussions Rss Feed
Viewing all articles
Browse latest Browse all 2157

New Post: CheckListBox not showing data

$
0
0
Hi,

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;
    }
  }

Viewing all articles
Browse latest Browse all 2157


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>