v
Not logged inv
SearchAsk a QuestionReport an IssueMake a SuggestionMy Questions and Issues
Issue Details
Find By ID

Bind to external source for a ListBox in DisplayTemplate of a Column

Issue Details

Log in to Track Changes or Edit
Q211475
Question
Anton Swanevelder
Yes
Processed
Customer Closed
.NET
AgDataGrid Suite
8.2.7
Windows XP
Microsoft Visual Studio 2008
7/3/2009 9:27:28 AM
-> Created by Anton Swanevelder 7/2/2009 6:11:40 PM

Hi,

I have a ListBox in the DataTemplate of one of Grid Columns. I want to be able to bind the ItemsSource to another collection of objects but cannot seem to get this working.

Do you perhaps have an example of how I can achieve this?

In the constructor I have this line of code:

this.Resources.Add("DocumentTypes", DocumentTypes);

And the below XAML for the Grid

<grid:AgDataGrid x:Name="grid" Margin="8,0,8,8" >
              <grid:AgDataGrid.Columns>
                   <grid:AgDataGridColumn FieldName="FileName" Width="248"/>
                <grid:AgDataGridColumn FieldName="DocumentTypeKey" Width="108">
                    <grid:AgDataGridColumn.DisplayTemplate>
                        <ControlTemplate TargetType="ListBox">
                            <ListBox x:Name="lbDocumentTypeKey" ItemsSource="{Binding Path=DocumentTypeKey, Source={StaticResource DocumentTypes}}" Height="25"/>
                        </ControlTemplate>
                    </grid:AgDataGridColumn.DisplayTemplate>
                </grid:AgDataGridColumn>
            </grid:AgDataGrid.Columns>
         </grid:AgDataGrid>

Thanks in advance,

Anton

<- Reviewed by DevExpress Team 7/3/2009 5:54:43 AM
<- Processed (Answered) by DevExpress Team 7/3/2009 8:29:30 AM

Attachment: Sample.zip (5609 bytes)

Hello Anton,

We have created a sample project for you. It uses the ListBox control for editing. Double-click the Name cell and select a new item in the list box.

Should you have additional questions, please feel free to ask us.

Thanks,
Nick
--------------------
Check if Search Engine is able to answer questions faster than I do!

-> Reactivated by Anton Swanevelder 7/3/2009 9:27:04 AM

You guys Rock! Thanks a million. Exactly what I needed.

<- Processed (Customer Closed) by Anton Swanevelder 7/3/2009 9:27:28 AM
Log in to Track Changes or Edit

Peer-to-Peer Discussion in DevExpress Forums

No discussion on this article has been started yet.

Please login to start discussion.

v
v
Search
Searching Tips