Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1420
xamGrid and ColumnLayout columns
posted

Ok, so I am opening a new topic with this issue

Hi, I am Marko

I am having a problem understanding how this works:

http://samples.infragistics.com/sllob/RunSamples.aspx?cn=grid#/grid/handling-hierarchical-data-sets

Can someone please put here some sample project with Access database (I am using SQL 2008) so that I can see how do I get data from the database into the class objects and the into grid. I am asking this cause I can't understand this part with binding data to the columns:

Text="{Binding Source={StaticResource Strings} , Path=XWG_OrderDetails_Discount}"

This is how I load data into grid from database: I make new class "Users" and make method in service "GetUsers" that executes sql query and gets data from db onto list of objects of "Users" class and returns that list. When execution of the service method is completed I do this xamGrid1.ItemsSource = e.Result; and grid displays data.

How is this "http://samples.infragistics.com/sllob/RunSamples.aspx?cn=grid#/grid/handling-hierarchical-data-sets" different ? comparing to the my method described above??

PS.  Can someone please put here some sample project with Access database.

Please help me resolve this issue,

Best regards,

Marko

Parents
  • 4475
    posted

    Hello,

    I have been looking into the sample provided and compared to your scenario the two implementations does basically the same, but the Infragistics sample performs the action via binding from the xaml.

    To be more specific, you set the xamGrid’s ItemsSource in the code behind. I am not sure what e.Result is, but I assume that this is the output from the service that provides the data. You mentioned that you have collection of Users that are loaded with data retrieved from the db. Let say that you have a Name property in this User class and you have filled it with a data. In case you have a textBox, like in the Infragistics sample, that you wish to fill with this name, you can do this in two different ways:

    From the code behind:

    myText.Text = User.Name;

    or bind it from the xaml:

    xmlns:local="clr-namespace:MySamle" //reference to the codehind

    .

    .

    <Grid.Resources>

    <local:User x:Key="UsrData"/> // we get the class

    </Grid.Resources>

    .

    .

    <Text="{Binding Source={StaticResource UsrData } , Path= Name }" // and bind to the needed property

    What happens in the sample is pretty much the same and it is possible to Grid’s ItemsSource from the xaml. Notice that you probably should implement the INotifyPropertyChanged interface, in order to have your TextBox updated according to its corresponding data source. For more information on the mentioned interface, please visit:

    http://msdn.microsoft.com/en-us/library/ms743695.aspx

    Please do not hesitate to ask any question regarding the original discussed topic .

    Sincerely,

    Ekaterina

    Developer Support Engineer

    Infragistics, Inc.

    www.infragistics.com/support

Reply Children