This is a migrated thread and some comments may be shown as answers.

ItemChanged : listnening to value change

6 Answers 147 Views
DataFilter
This is a migrated thread and some comments may be shown as answers.
Benjamin
Top achievements
Rank 1
Benjamin asked on 14 Jun 2013, 09:20 AM
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

6 Answers, 1 is accepted

Sort by
0
Rossen Hristov
Telerik team
answered on 14 Jun 2013, 09:56 AM
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.

0
Benjamin
Top achievements
Rank 1
answered on 14 Jun 2013, 12:11 PM
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

0
Rossen Hristov
Telerik team
answered on 14 Jun 2013, 01:08 PM
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.

 
0
Benjamin
Top achievements
Rank 1
answered on 14 Jun 2013, 01:44 PM
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...
0
Yoan
Telerik team
answered on 19 Jun 2013, 09:57 AM
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.

0
Benjamin
Top achievements
Rank 1
answered on 29 Jun 2013, 02:14 PM
Hello Yoan,

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

Best regards,

Benjamin
Tags
DataFilter
Asked by
Benjamin
Top achievements
Rank 1
Answers by
Rossen Hristov
Telerik team
Benjamin
Top achievements
Rank 1
Yoan
Telerik team
Share this question
or