using EditTemplateSelector

2 posts, 0 answers
  1. Dario Concilio
    Dario Concilio avatar
    180 posts
    Member since:
    Apr 2016

    Posted 02 Dec 2016 Link to this post

    Hi to all,

    I'm trying to use an EditTemplateSelector, but I have problem to retrieve DataContext of RadWindow, my RadWindow has x:Name="radWindow", its relative ViewModel exposes a List<T> collection called StatiCertificato, it seems that it not found it.

    When selector use campoEditTesto it works correctly and it works correclty with campoEditData also, when it uses campoEditStato or campoEditDecisione show me correctly RadComboBox but without items. It checked that my collection are full.

    Am I using a wrong approach for binding into ItemSource property? If yes, what's wrong?

    <templateSelector:ValoreEditTemplateSelector x:Key="campiEditTemplateSelector">
                <TextBox Text="{Binding Valore,Mode=TwoWay}"  />
                <telerik:RadComboBox ItemsSource="{Binding StatiCertificato, ElementName=radWindow}"
                                     SelectedItem="{Binding StatoCertificatoSelezionato,Mode=TwoWay}"
                                     DisplayMemberPath="Descrizione" SelectedValuePath="Valore"/>
                <telerik:RadComboBox ItemsSource="{Binding DecisioniCertificato, ElementName=radWindow}"
                                     SelectedItem="{Binding DecisioneCertificatoSelezionato,Mode=TwoWay}"
                                     DisplayMemberPath="Descrizione" SelectedValuePath="Valore"/>
                <telerik:RadDatePicker SelectedValue="{Binding Valore, Mode=TwoWay, Converter={StaticResource editDateConverter}}"/>
  2. Lance | Manager Technical Support
    Lance | Manager Technical Support avatar
    1159 posts

    Posted 02 Dec 2016 Link to this post

    Hello Dario,

    Its difficult to determine the underlying cause of the issue without seeing more of your code. Can you put together a small, runnable, sample project that reproduces the issue so that we can debug it directly.

    You can make it very simple to reproduce it: just use a single page with your GridView, your RadWindow, the DataTemplates and the TemplateSelectors, and a couple rows of sample data in a stripped down ViewModel.

    Note: since you've posted in a forum thread, you won't be able to attach a ZIP file. You can either open a support ticket (you can open a support ticket here) which allows you to attach such files or reply here with a link for us to download the ZIP (e.g. Dropbox).

    With this we can help determine why your bindings are not working properly. Thank you for your understanding while we work to resolve your problem.

    Lance | Tech Support Engineer, Sr.
    Telerik by Progress
    Telerik UI for WPF is ready for Visual Studio 2017 RC! Learn more.
Back to Top