Hello Telerik Team,
I have one problem in my WPF project.Let i explain in detail
In my UI contains three TextBoxes..
All are set into UpdateSourceTrigger=LostFocus;
and also i have standard menu bar
The menu bar purpose is saving the details to database..
Every time after entered value in textbox atleast one time i change focus to another control then only
the values are updated.Problem is if i enter third Textbox value mean here i change focus to second textbox or first textbox then only Third box value updated.
Here i want to update third box value without changing focus to firstbox or second box..
so i make some codes in Codebehind it comes,
The Binding expression binding value when still focus in third TextBox also...(not leaveing focus to other control)
after that i am clicking save in menuItem all values are comes correctly.Third value also updated.
After that i am changing standard menubar to RadMenu .
Here also i am doing same process.but its not return thid textbox value..
I realize where is the mistake comes from
if suppose i am using standard menu and the focus is in third textBox
that time i am clicking save means inside save method comes Keyboard.FocusElement=TextBox (finding using debugging)
same time if i am using Radmenu and the focus is in third textbox
that time i am clicking save means inside save method comes Keyboard.FocusElement=Save will come not TextBox..
I don't know why Telerik.wimdows.controls.Radmenu Header.save come instead of Textbox
can anybody give correct solution?
give me solution in detail..
Thank you.....
I have one problem in my WPF project.Let i explain in detail
In my UI contains three TextBoxes..
<Label Content="First _name:" HorizontalAlignment="Right" Margin="0,40,408,247" Target="{Binding ElementName=firstNameTxt}" /> <TextBox Margin="101,40,101,247" Name="firstNameTxt" Text="{Binding Path=FirstName, ValidatesOnDataErrors=True, =LostFocus}" /> <Label Content="_Last name:" HorizontalAlignment="Right" Margin="0,72,408,216" Target="{Binding ElementName=lastNameTxt}" /> <TextBox Margin="101,72,101,216" Name="lastNameTxt" Text="{Binding Path=LastName, ValidatesOnDataErrors=True, UpdateSourceTrigger=LostFocus}" /> <Label Content="E-_mail:" HorizontalAlignment="Right" Margin="0,104,408,184" Target="{Binding ElementName=emailTxt}" /> <TextBox Margin="101,104,101,184" Name="emailTxt" Text="{Binding Path=Email, ValidatesOnDataErrors=True, UpdateSourceTrigger=LostFocus}" />and also i have standard menu bar
<Menu Height="23" Name="menu1" VerticalAlignment="Top"> <MenuItem Header="File"> <MenuItem Header="Save" Click="MenuItem_Click" /> </MenuItem> </Menu>Every time after entered value in textbox atleast one time i change focus to another control then only
the values are updated.Problem is if i enter third Textbox value mean here i change focus to second textbox or first textbox then only Third box value updated.
Here i want to update third box value without changing focus to firstbox or second box..
so i make some codes in Codebehind it comes,
public partial class MainWindow : Window { public MainWindow() { InitializeComponent(); } private void Window_Loaded(object sender, RoutedEventArgs e) { this.DataContext = Customer.CreateNewCustomer(); } private void MenuItem_Click(object sender, RoutedEventArgs e) { if (Keyboard.FocusedElement.GetType() == typeof(TextBox)) { BindingExpression exprLastName = ((TextBox)
Keyboard.FocusedElement).GetBindingExpression(TextBox.TextProperty); exprLastName.UpdateSource(); } MessageBox.Show("Passed\n" + ((Customer)this.DataContext).FirstName + "\n" + ((Customer)this.DataContext).LastName + "\n" + ((Customer)this.DataContext).Email); } }after that i am clicking save in menuItem all values are comes correctly.Third value also updated.
After that i am changing standard menubar to RadMenu .
Here also i am doing same process.but its not return thid textbox value..
I realize where is the mistake comes from
if suppose i am using standard menu and the focus is in third textBox
that time i am clicking save means inside save method comes Keyboard.FocusElement=TextBox (finding using debugging)
same time if i am using Radmenu and the focus is in third textbox
that time i am clicking save means inside save method comes Keyboard.FocusElement=Save will come not TextBox..
I don't know why Telerik.wimdows.controls.Radmenu Header.save come instead of Textbox
can anybody give correct solution?
give me solution in detail..
Thank you.....