Cannot set both DisplayMemberPath and ItemTemplate

2 posts, 0 answers
  1. kity
    kity avatar
    71 posts
    Member since:
    Mar 2012

    Posted 19 Aug 2014 Link to this post

    I undestend that you some how with internal buisness logic set TextSearch.TextPath if developer set DisplayMemberPath value with ItemTemplate.
    How you do it that with runtime code example?

    I inherited your RadCombobox class

    class EditComboBox : RadCombobox {
    }

    <Grid>
    <controls:EditComboBox x:Name="ecbControl" telerik:TextSearch.TextPath="Description" />
    </Grid>


    How to dinamicly set
    MyEditComboBox.TextSearch.TextPath="Description" ?

    Here is my property

    private static readonly DependencyProperty CurrentDisplayMemberPathProperty = DependencyProperty.RegisterAttached("CurrentDisplayMemberPath", typeof(string), typeof(EditComboBoxUserControl), new FrameworkPropertyMetadata(OnCurrentDisplayMemberPath));
           private static void OnCurrentDisplayMemberPath(DependencyObject d, DependencyPropertyChangedEventArgs e)
           {
               var view = (d as EditComboBoxUserControl);
               if (view == null)
                   return;
               string value = (string)e.NewValue;
               view.CurrentDisplayMemberPath = value;           
           }
           [DefaultValue("")]
           [Localizability(LocalizationCategory.Text)]
           [Bindable(true)]
           public string CurrentDisplayMemberPath
           {
               get
               {
                   return (string)GetValue(CurrentDisplayMemberPathProperty);
               }
               set
               {
                   SetValue(CurrentDisplayMemberPathProperty, value);
                   // Telerik.Windows.Controls.TextSearch.SetTextPath(this.ecbControl, value);
                   //this.ecbControl.DisplayMemberPath = value;
               }
           }

    Place your code is settary of dependancy property.
  2. kity
    kity avatar
    71 posts
    Member since:
    Mar 2012

    Posted 19 Aug 2014 in reply to kity Link to this post

    May be if you undestend me, you will chosee some of two comment lines and then you will make some refactoring in control.
    For example:

    this.myComboBoxControl.NewDisplayMemberPath = value;
  3. UI for WPF is Visual Studio 2017 Ready
Back to Top