ItemChanged : listnening to value change

7 posts, 0 answers
  1. Benjamin
    Benjamin avatar
    24 posts
    Member since:
    Dec 2012

    Posted 14 Jun 2013 Link to this post

    Hello,

    I'm using the ItemChanged event but when the user write a value in a filter, the event is not raised until the user press the enter key.
    I need to know when the user change the filter value on property changed.
    How can I handle this,

    Thank you,

    Benjamin
  2. Rossen Hristov
    Admin
    Rossen Hristov avatar
    2478 posts

    Posted 14 Jun 2013 Link to this post

    Hi,

    The default WPF TextBox updates its Text when the focus is lost or when Enter is pressed. This is its behavior. Until that happens nothing is ever changed. So there is no possible way to receive an event that something has changed before it has actually changed.

    I am afraid that I cannot think of a way to bypass this limitation.

    Regards,
    Rossen Hristov
    Telerik

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  3. UI for WPF is Visual Studio 2017 Ready
  4. Benjamin
    Benjamin avatar
    24 posts
    Member since:
    Dec 2012

    Posted 14 Jun 2013 Link to this post

    Thank for your quick answer,

    Correct me if i'm wrong but the updates method is define by the UpdateSourceTrigger property of the Binding.
    Could you provide a way to choos the Biding UpdateSourceTrigger to use ine the ItemPropertyDefinition ?

    I would like something like that :

    <telerik:RadExpander Grid.Row="0" Header="FILTRES" Style="{StaticResource RadExpanderBCMStyle}">
      <telerik:RadDataFilter x:Name="_RadDataFilter" AutoGenerateItemPropertyDefinitions="False" Style="{StaticResource RadDataFilterBCMStyle}">
        <telerik:RadDataFilter.ItemPropertyDefinitions>
          <dataFilter:ItemPropertyDefinition PropertyName="Title"                  UpdateSourceTrigger="PropertyChanged"   DisplayName="Titre"         PropertyType="{Binding String, Source={StaticResource Types}}"/>
          <dataFilter:ItemPropertyDefinition PropertyName="StartDateTime" UpdateSourceTrigger="PropertyChanged" DisplayName="Date de début" PropertyType="{Binding DateTime, Source={StaticResource Types}}"/>
          <dataFilter:ItemPropertyDefinition PropertyName="EndDateTime"     UpdateSourceTrigger="PropertyChanged"   DisplayName="Date de fin"   PropertyType="{Binding DateTime, Source={StaticResource Types}}"/>
          <dataFilter:ItemPropertyDefinition PropertyName="Description"     UpdateSourceTrigger="PropertyChanged"   DisplayName="Description"   PropertyType="{Binding String, Source={StaticResource Types}}"/>
        </telerik:RadDataFilter.ItemPropertyDefinitions>
      </telerik:RadDataFilter>
    </telerik:RadExpander>


    thank you,

    Benjamin

  5. Rossen Hristov
    Admin
    Rossen Hristov avatar
    2478 posts

    Posted 14 Jun 2013 Link to this post

    Hi,

    I will try to explain.

    Those things called ItemPropertyDefinitions are simple .NET classes that have several properties which allow you to specify what you want to see in RadDataFilter. They are simple property bags and just carry this information -- they are not used for anything else besides that. Those things are not seen on the screen. They are not UI elements. The UpdateSourceTrigger that you defined on them does absolutely nothing and has absolutely no meaning at all and I am not sure where did you see such an example with this code. It does not make any sense to write that.

    What you see on the screen is a TextBox where the user types what he wants to filter on. For example this editor could be a WPF TextBox. Or another editor based on the type of property being edited. For DateTimes you will see a RadDateTimePicker serving as the editor, for strings you will see a StringFilterEditor which is also our class, for all other types including the numeric ones you will see a plain old WPF TextBox.

    If you don't like the standard WPF TextBox, you can try to replace it with your own editor as described in this help topic

    Regards,
    Rossen Hristov
    Telerik

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

     
  6. Benjamin
    Benjamin avatar
    24 posts
    Member since:
    Dec 2012

    Posted 14 Jun 2013 Link to this post

    Hi,

    Maybe I wasn't very explicit so I will try to explain you what I was thinking.
    I know that ItemPropertyDefinition are not the UI elements and is just a way for you to get the information you need for the DataFilter. The code I wrote was  made to show you an example of what I wanted and of course can't work for now.
    I Know you use Binding on the UI Editor for retreiving the Text wrote by the user in your DataContext class and I was asking if you could create a property that allow me to specify the UpdateSourceTrigger to use in this binding.

    PS : Your link is broken...
  7. Yoan
    Admin
    Yoan avatar
    1068 posts

    Posted 19 Jun 2013 Link to this post

    Hello Benjamin,

    Please find attached a sample project which shows you how to modify the behavior of the TextBox (which is in our StringFilterEditor). You need to modify the default editor by attaching to the FieldFilterEditorCreated event. Then you can use our public class called Telerik.Windows.Controls.TextBoxBehavior.

    I hope this helps.

    Regards,
    Yoan
    Telerik

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  8. Benjamin
    Benjamin avatar
    24 posts
    Member since:
    Dec 2012

    Posted 29 Jun 2013 Link to this post

    Hello Yoan,

    Thank you for the example, it help me to resolve my problem.

    Best regards,

    Benjamin
Back to Top
UI for WPF is Visual Studio 2017 Ready