How to retain Selected Value based on user input

8 posts, 0 answers
  1. Dharmavaram
    Dharmavaram avatar
    72 posts
    Member since:
    Jun 2013

    Posted 23 Sep Link to this post

     Hi,

       I have three choices for one of the property and I am showing them in combobox.Once user changes the choices we will take confirmation from user if he says no I have to retain the old value and show in the combo the selected value as oldvalue.But here I am not changing the value of model property but combobox value changing to new value.How to stop it??

     

    For Example:

      Property Name :Transportation

    Property Values : Enum vehicles

                                 {

    Bus,

    Car,

    Walk

                                  }

     

     

  2. Dharmavaram
    Dharmavaram avatar
    72 posts
    Member since:
    Jun 2013

    Posted 23 Sep in reply to Dharmavaram Link to this post

    Hi,

      In the above post I have given half information. If Selected value is Bus and then user changes to car.We will ask confirmation and If he says no I should not select car.But here in propertygrid it is showing Car. 

    How to stop this??

    Regards,

    Nagasree.

  3. UI for WPF is Visual Studio 2017 Ready
  4. Stefan X1
    Admin
    Stefan X1 avatar
    514 posts

    Posted 27 Sep Link to this post

    Hello Nagasree,

    Basically, you should be able to revert to the previous selected item through the Selection mechanism of the control. May I ask you to share a little more information on how the combobox editor is defined?

    Best Regards,
    Stefan X1
    Telerik by Progress
    Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
  5. Dharmavaram
    Dharmavaram avatar
    72 posts
    Member since:
    Jun 2013

    Posted 27 Sep in reply to Stefan X1 Link to this post

    Hi Stefan,

        I didn't specified Combobox Editor,PropertyGrid itself giving the Combobox Editor as the property type is Enum. As we know based on the type of the property propertygrid itself provides respective template for the PropertyValue,here I am gettting the Combobox.

    Regards,

    Nagasree

  6. Stefan X1
    Admin
    Stefan X1 avatar
    514 posts

    Posted 29 Sep Link to this post

    Hi Nagasree,

    RadPropertyGrid does not expose its autogenerated editors for such modifications. A possible approach would be to define the EditorTemplate for the particular PropertyDefinition and setup the combobox within it. Please take a look at the Customized Property Definitions topic for more information on the matter.

    Hopefully, this helps.

    Regards,
    Stefan X1
    Telerik by Progress
    Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
  7. Dharmavaram
    Dharmavaram avatar
    72 posts
    Member since:
    Jun 2013

    Posted 03 Oct in reply to Stefan X1 Link to this post

    Hi Stefan,

    I have checked ComboboxEditorBooleanProperty_WPF  sample application. I already tried to create usercontrol and use it.But I am not able to achieve my expected behavior.

    http://www.telerik.com/forums/how-to-show-list-string-as-combobox-values-instead-of-collection-editor

    I have explained my problem in the above post still clearly. I completely blocked by this problem.Could you please help me??

  8. Dharmavaram
    Dharmavaram avatar
    72 posts
    Member since:
    Jun 2013

    Posted 04 Oct in reply to Dharmavaram Link to this post

    Hi Stefan,

      I am providing some more information here. Last one week I am doing lot of trial and errors.I will share that information with so that you can help me further.

    <UserControl x:Class="DataGrid.CustomCombo"
                 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                 xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
                  xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
                 mc:Ignorable="d" d:DesignWidth="289" Height="69"  >
        <StackPanel>
            <telerik:RadComboBox Name="ControlCombo" SelectedIndex="{Binding SelectedValue, Mode=TwoWay}"/>
        </StackPanel>
     
    </UserControl>

    Property for which I am using above mentioned usercontrol as Editor. 

    private String _stringProperty ="Hi";
     
         [Telerik.Windows.Controls.Data.PropertyGrid.Editor(typeof(CustomCombo),"SelectedValue", Telerik.Windows.Controls.Data.PropertyGrid.EditorStyle.None)]    
         public String StringProperty
         {
             get
             {
                 return _stringProperty;
            
             }
     
             set
             {
                 _stringProperty = value;
             }
            
         }
     
         private List<String> myVar = new List<string>() {"Nagasree","Sumasree","Sreeram"};
     
         public List<String> MyProperty
         {
             get { return myVar; }
             set { myVar = value; }
         }

    I am populating the combobox from code behind in fieldloaded event as I didn't find any nice other approach as shown below.

    private void PropertyGrid_FieldLoaded(object sender, FieldEventArgs e)
        {
            if (e.Field.Content is CustomCombo)
            {
                CustomCombo cb = e.Field.Content as CustomCombo;
                cb.ControlCombo.ItemsSource = ((Employee)cb.DataContext).MyProperty;
            }
     }

     

     Now I want to bind the selected Item in the combobox to the string Property.How to achieve this??

    I tried to bind to the property in usercontrol creating DependencyProperty but I am not succesful.Please give solution as soon as possible.

    Regards,

    Nagasree.

  9. Dharmavaram
    Dharmavaram avatar
    72 posts
    Member since:
    Jun 2013

    Posted 05 Oct in reply to Dharmavaram Link to this post

    Hi,

    I found answer here http://www.telerik.com/forums/how-to-show-list-string-as-combobox-values-instead-of-collection-editor#JX8h-tbgvkS_iBnINcu9iQ

Back to Top
UI for WPF is Visual Studio 2017 Ready