Welcome to the Xceed Community | Help
Community Search  
More Search Options

How to Bind to the same grid diffrent cases of data using LinqToEntities Model?

Sort Posts: Previous Next
  •  04-27-2010, 3:41 AM Post no. 26622

    How to Bind to the same grid diffrent cases of data using LinqToEntities Model?

    Hi,

    i am using LinqToEntities Model and i want to fill the grid with a different content depending on the user choices .

    What is the best way to do it?

     

    Best regards

    Orel.

     


  •  04-29-2010, 2:07 PM Post no. 26652 in reply to 26622

    Re: How to Bind to the same grid diffrent cases of data using LinqToEntities Model?

    Greetings,

    I am doing something exactly like this.  But ran into some problems with auto generating cols because the entire model is shown.  First, I wanted to use the same model returned from the DBML (I am using LINQ to SQL). 

    What I ended up doing is adding all of the columns to the grid as Visible false (watch out for the 3.7 bug one col need to be vis true), then in my view model, I created custom views that a user can choose and just showed them.  Of course, I had to pass a ref of the DataGrid to my VM, which is not good MVVM practice, but the xceed Cols are not part of the visualtree and you can not get the datacontext of the parent and bind to visible.  Note: there is a post here on how to do this in code behind, and I tried, but I lost the binding if you change the visibility in the columnchooser.

    Anyway.. here is a snippet.. NOTE: in another method I looped and set all cols to vis = false (again, except for one or crash)

    private void PMCustomView()

    {

     

    List<String> cols = new List<string>{

    "BlahBlah",

    "SomeColumn",

    // set the cols

    cols.ForEach(x => this.GridControl.Columns[x].Visible = true);

    }

     

    Anyway.. some food for thought.

    Micah

View as RSS news feed in XML
Contact | Site Map | Reviews | Legal Terms of Use | Trademarks | Privacy Statement Copyright 2011 Xceed Software Inc.