Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • User (Old forums)
    Member
    Post count: 23064
    #22585 |

    Hi,

    I have two datatables (parent and child) which are related by a column. What I’m trying to do is to fill one column in the datagridcontrol with the info from the second table that is related to the actual row in my grid.

    <xcdg:DataGridControl x:Name=”logReport” ItemsSource=”{Binding Source={StaticResource dataTables}, Path=issue}” AutoCreateColumns=”False” >
    <xcdg:DataGridControl.Columns>
    <xcdg:Column FieldName=”uid” Width=”50″ Title=”#” />
    <xcdg:Column FieldName=”links/attach” Width=”100″ TextWrapping=”Wrap” Title=”Links / Attachments” >
    <xcdg:Column.CellContentTemplate>
    <DataTemplate>
    <StackPanel>
    <ListBox Background=”Transparent” BorderBrush=”Transparent” Width=”100″ ItemsSource=”{Binding Source={StaticResource dataTables}, Path=link}” DisplayMemberPath=”name” />
    </StackPanel>
    </DataTemplate>
    </xcdg:Column.CellContentTemplate>
    </xcdg:Column>
    </xcdg:DataGridControl.Columns>
    </xcdg:DataGridControl>

    The problem with my code is that the listbox displays all the data in the child table… Is there a Way to relate this?

    Thanks!

    Imported from legacy forums. Posted by Lilian (had 1806 views)

    Xceed Support
    Member
    Post count: 5658

    Hi, in your Column’s CellContentTemplate that contains the ListBox, instead of Binding to the ListBox.ItemsSource to the “complete” datatable from your resources, what you should do is bind to the current DataRowView’s relation… (be sure the relation exists).

    So, in your ListBox, the Binding would look like:

    <ListBox ItemsSource=”{Binding <i>relationName</i>}” />

    You can see another example of this in this forum post:

    <a href=”http://forums.xceed.com/forums/ShowPost.aspx?PostID=6427″>http://forums.xceed.com/forums/ShowPost.aspx?PostID=6427</a&gt;

    Imported from legacy forums. Posted by Marcus [Xceed] (had 2874 views)

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.