Dynamic Data Binding with CellEditTemplate

5 posts, 1 answers
  1. Philipp Egger
    Philipp Egger avatar
    5 posts
    Member since:
    Oct 2009

    Posted 29 Sep 2010 Link to this post

    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




  2. Philipp Egger
    Philipp Egger avatar
    5 posts
    Member since:
    Oct 2009

    Posted 30 Sep 2010 Link to this post

    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...
  3. DevCraft banner
  4. Answer
    Vlad
    Admin
    Vlad avatar
    11100 posts

    Posted 30 Sep 2010 Link to this post

    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
     
  5. Kurt Landuyt
    Kurt Landuyt avatar
    4 posts
    Member since:
    Sep 2010

    Posted 09 Apr 2015 Link to this post

    Hi Vlad,

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

     Are you able to provide me new link?

    Thanks!

  6. Stefan X1
    Admin
    Stefan X1 avatar
    523 posts

    Posted 10 Apr 2015 Link to this post

    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.

     
Back to Top
DevCraft banner