This is a migrated thread and some comments may be shown as answers.

Dynamic Data Binding with CellEditTemplate

4 Answers 120 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Philipp Egger
Top achievements
Rank 1
Philipp Egger asked on 29 Sep 2010, 02:26 PM
Hi,

I have 2 questions about the GridView's CellEditTemplate when it comes to dynamic data binding.

My coding:

1. RadGridView control (AutoGenerateColumns = "False")
2. CellEditTemplate which has to be assigned dynamically in the code:
<UserControl.Resources>
  <DataTemplate x:Key="cellEditTemplate">
    <sdk:AutoCompleteBox Name="autoCompBox" IsTextCompletionEnabled="False"
         FilterMode="Contains" 
         Populating="AutoCompleteBox_Populating" MinimumPrefixLength="3"
         IsDropDownOpen="True"
         Text="{Binding InputString2}" />
  </DataTemplate>
</UserControl.Resources>
  
// generate the columns in the code
GridViewDataColumn col = new GridViewDataColumn();
...
col.CellEditTemplate = Resources["cellEditTemplate"] as DataTemplate;

Question 1: With 'Text="{Binding InputString2}"' I bind to a particular column. I want to have that binding dynamically handled: for each column that uses that CellEditTemplate the data binding should work.

Question 2: In the CellEditTemplate I have a AutoCompleteBox. At the moment, it is not writing back the selected value from the AutoCompleteBox into the column that is in edit mode.

Thanks for any hints.

Phil




4 Answers, 1 is accepted

Sort by
0
Philipp Egger
Top achievements
Rank 1
answered on 30 Sep 2010, 10:14 AM
Any hints?

Just for better understanding

I would like to do the following:

1. Define a Template
XAML:
<UserControl.Resources>
   <DataTemplate x:Key="cellEditTemplate">
      <sdk:AutoCompleteBox 
           Name="autoCompBox" 
           IsTextCompletionEnabled="False" 
           FilterMode="Contains" 
           Populating="AutoCompleteBox_Populating" 
           MinimumPrefixLength="3" 
           IsDropDownOpen="True" 
           Text="{Binding InputString2}" />
   </DataTemplate>
</UserControl.Resources>

And use this Template multiple times in the code.

Code:
GridViewDataColumn col = new GridViewDataColumn();
col.UniqueName = "InputString2";
col.CellEditTemplate = Resources["cellEditTemplate"] as DataTemplate;
this.radGridView2.Columns.Add(col);
  
col = new GridViewDataColumn();
col.UniqueName = "InputString3";
col.CellEditTemplate = Resources["cellEditTemplate"] as DataTemplate;
this.radGridView2.Columns.Add(col);

Problem is the data binding with Text="{Binding InputString2}" .

Thanks...
0
Accepted
Vlad
Telerik team
answered on 30 Sep 2010, 11:25 AM
Hello,

 Please check CellValueBindingBehavior from this blog post. 

Greetings,
Vlad
the Telerik team
 
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
 
0
Kurt Landuyt
Top achievements
Rank 1
answered on 09 Apr 2015, 03:32 PM

Hi Vlad,

The blog post above is unfortunately offline '404 - File or directory not found.'

 Are you able to provide me new link?

Thanks!

0
Stefan
Telerik team
answered on 10 Apr 2015, 11:54 AM
Hello Kurt ,

Here is the new link for this blog post: Highlighting Inline Search for RadGridView for Silverlight.

Best Regards,
Stefan
Telerik
 

See What's Next in App Development. Register for TelerikNEXT.

 
Tags
GridView
Asked by
Philipp Egger
Top achievements
Rank 1
Answers by
Philipp Egger
Top achievements
Rank 1
Vlad
Telerik team
Kurt Landuyt
Top achievements
Rank 1
Stefan
Telerik team
Share this question
or