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

RadButton when clicked doesn't save TexBox input

0 Answers 56 Views
Buttons
This is a migrated thread and some comments may be shown as answers.
sam
Top achievements
Rank 1
sam asked on 02 Mar 2018, 06:32 PM

Hi,

I am working on a large-scale WPF application using Telerik Controls and seeing a problem that my TextBox input is not being saved when I click my RadButton to save.  The problem is tied to the fact that the TextBox never looses focus and I'm typing in an input and just clicking Save afterwards.  Since the Textbox doesn't loose focus the property is never updated.  I know that a possible fix is to add UpdateSourcetrigger=PropertyChanged to my TextBox's Binding but since I have this occurring all over the application, it would be hard to accomplish.   I want a generic solution that allows me to save the content of my input even without having to tab out of the control.

Please advise possible solutions.

Thanks.

 

Here is wpf c# code on my MenuButton:

namespace Stream.WPF.Infrastructure.Controls
{
    using System.Windows;
    using System.Windows.Media;

    using Telerik.Windows.Controls;

    public class MenuButton : RadButton
    {
        public static readonly DependencyProperty ImageSourceProperty = DependencyProperty.Register(
            "ImageSource",
            typeof(ImageSource),
            typeof(MenuButton),
            new UIPropertyMetadata(default(ImageSource)));

        public static readonly DependencyProperty LabelProperty = DependencyProperty.Register(
            "Label",
            typeof(string),
            typeof(MenuButton));

        public ImageSource ImageSource
        {
            get
            {
                return (ImageSource)this.GetValue(ImageSourceProperty);
            }

            set
            {
                this.SetValue(ImageSourceProperty, value);
            }
        }

        public string Label
        {
            get
            {
                return (string)this.GetValue(LabelProperty);
            }

            set
            {
                this.SetValue(LabelProperty, value);
            }
        }
    }
}

And in my XAML I am using it like this:

 <customControls:MenuButton Grid.Column="1" Content="{x:Static resources:ProperNameResources.Overview}" Margin="30,2,30,2" Background="#005A8B"
                                   Command="{Binding Owner.SelectedTourSheetViewModel.ShowOverviewCommand}"
                                   Visibility="{Binding Owner.SelectedTourSheetViewModel.IsOverviewDisplayed, Converter={StaticResource InverseBoolToVisibilityConverter}}"/>

 

 

No answers yet. Maybe you can help?

Tags
Buttons
Asked by
sam
Top achievements
Rank 1
Share this question
or