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

Lost Focus event for textbox in raddataform.

0 Answers 268 Views
DataForm
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Amitkumar
Top achievements
Rank 1
Amitkumar asked on 08 Jun 2012, 02:22 PM

Hi Telerik

Again required your help….

I am using radrataform. I am not using auto-generating column.  I have two Textbox. One is Autocomplete and second is Textbox.

Now my requirement is when autocomplete focus is lost I have to perform one operation like…

 I am entering city name in Autocomplete box then second textbox zip code should automatically fill (through service).

Now my Issue is I am not able to getting lost focus event of my autocomplete textbox in my View Model.

 Here I attached screen of my xaml.

<telerik:RadDataForm   Width="600" Grid.Row="1" VerticalAlignment="Top"
                                x:Name="myRadDataForm"
                                Header="Data"
                                                    
                                                    
                                ItemsSource="{Binding Product }"                                       
                                          AutoGenerateFields="False"
                           ReadOnlyTemplate="{StaticResource MyTemplate}"
                           EditTemplate="{StaticResource MyTemplate}"
                           NewItemTemplate="{StaticResource MyTemplate}">
                            </telerik:RadDataForm>
 
 
<Grid.RowDefinitions>
                                <RowDefinition></RowDefinition>
                                <RowDefinition></RowDefinition>
 
                            </Grid.RowDefinitions>
 
                            <Grid.Resources>
 
                                <DataTemplate x:Key="MyTemplate">
                                    <Grid>
                                        <Grid.RowDefinitions>
                                            <RowDefinition></RowDefinition>
                                            <RowDefinition></RowDefinition>
                                        </Grid.RowDefinitions>
                                        <Grid.ColumnDefinitions>
                                            <ColumnDefinition></ColumnDefinition>
                                            <ColumnDefinition></ColumnDefinition>
                                            <ColumnDefinition></ColumnDefinition>
 
                                        </Grid.ColumnDefinitions>
 
 
 
                                        <TextBlock Text="Barcode" Grid.Row="0" Grid.Column="0" >
                                        </TextBlock>
                                        <syncControls:AutoCompleteBox  x:Name="autBarcode"  Text="{Binding Barcode, Mode=TwoWay}" Grid.Row="0" Grid.Column="1">
                                        </syncControls:AutoCompleteBox>
 
                                        <TextBlock Text="UOM" Grid.Row="1" Grid.Column="0"   />
                                        <TextBox   x:Name="txtUOMDescription"  Text="{Binding UOMDescription, Mode=TwoWay}" Grid.Row="1" Grid.Column="1" />
 
                                    </Grid>
                                </DataTemplate>
                            </Grid.Resources>

MyRadDataForm.CurrentItemChanged += new EventHandler<EventArgs>(MyRadDataForm_CurrentItemChanged);
 
MyRadDataForm.AutoGeneratingField += new EventHandler<Telerik.Windows.Controls.Data.DataForm.AutoGeneratingFieldEventArgs>(MyRadDataForm_AutoGeneratingField);
 
MyRadDataForm.DataContextChanged += new DependencyPropertyChangedEventHandler(MyRadDataForm_DataContextChanged);
 
myRadDataForm.EditEnded += new EventHandler<Telerik.Windows.Controls.Data.DataForm.EditEndedEventArgs>(myRadDataForm_EditEnded);
 
MyRadDataForm.EditEnding += new EventHandler<Telerik.Windows.Controls.Data.DataForm.EditEndingEventArgs>(MyRadDataForm_EditEnding);
 
MyRadDataForm.LostFocus += new RoutedEventHandler(MyRadDataForm_LostFocus);
 
MyRadDataForm.ValidatingItem += new EventHandler<CancelEventArgs>(MyRadDataForm_ValidatingItem);

void MyRadDataForm_ValidatingItem(object sender, CancelEventArgs e)
       {
            
       }
 
       void MyRadDataForm_LostFocus(object sender, RoutedEventArgs e)
       {
 
           TextBox k = sender as TextBox;
           if (k != null)
           {
               string d = k.Name;
               string r = k.Text;
           }
 
       }
 
       void MyRadDataForm_EditEnding(object sender, Telerik.Windows.Controls.Data.DataForm.EditEndingEventArgs e)
       {
 
       }
 
       void myRadDataForm_EditEnded(object sender, Telerik.Windows.Controls.Data.DataForm.EditEndedEventArgs e)
       {
 
       }
 
       void MyRadDataForm_DataContextChanged(object sender, DependencyPropertyChangedEventArgs e)
       {
 
       }
 
       void MyRadDataForm_AutoGeneratingField(object sender, Telerik.Windows.Controls.Data.DataForm.AutoGeneratingFieldEventArgs e)
       {
 
       }
 
       void MyRadDataForm_CurrentItemChanged(object sender, EventArgs e)
       {
           if ((sender as RadDataForm).IsItemChanged)
           {
               //this.MyRadDataForm.CurrentItem
           }
       }

Thank you
Amit

Tags
DataForm
Asked by
Amitkumar
Top achievements
Rank 1
Share this question
or