Timepicker Updatesourcetrigger = propertychanged不更改值 [英] Timepicker Updatesourcetrigger=propertychanged doesn't change value

查看:133
本文介绍了Timepicker Updatesourcetrigger = propertychanged不更改值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在Windows窗体中托管一个WPF用户控件
在wpf用户控件中,我正在使用wpfToolkit.extended中的timepicker



如果我使用up或downkeys或者只是在textfield中输入一个时间源不被更新allthough我正在使用Updatesourcetrigger = propertychanged。



当我在dropdrownlist中选择一个时间一切正常应该的方式
这是工具包的命名空间。

  xmlns:xctk =clr-namespace:Xceed.Wpf.Toolkit ; assembly = WPFToolkit.Extended

这是timepicker的xaml

$ b $时间间隔格式=LongTimeTimeInterval =00:15:00.000Value ={Binding Path = StartTime,UpdateSourceTrigger = PropertyChanged}b

 < xctk: >< / xctk:TimePicker> 

如果我在WPFusercontrol外面单击,而不是将焦点改为wpf usercontrol中的另一个控件。绑定的时间没有更新。



任何想法如何解决这个问题?

解决方案

找到解决这个问题的解决方案:
我给了TimePicker一个名字(在这种情况下是'tpFrom'),那么我在TimePicker上使用了TextBoxBase.TextChanged事件。
这是Xaml现在的样子:

 < xctk:TimePicker Name =tpFromFormat = LongTimeTextBoxBase.TextChanged =TimePicker_TextChangedTimeInterval =00:15:00.000Value ={Binding Path = StartTime,UpdateSourceTrigger = PropertyChanged}>< / xctk:TimePicker> 

在我们的eventhandler中的代码中,我们将重点放在我们的timepicker上。

  private void TimePicker_TextChanged(object sender,TextChangedEventArgs e)
{
tpFrom.Focus();
}

现在,每当文字发生变化时,值也会发生变化,问题解决: - )


I'm hosting a WPF usercontrol in a windows form In the wpf user control I am using a timepicker from wpfToolkit.extended

If I use the up or downkeys or just enter a time in the textfield the source is not updated allthough I am using Updatesourcetrigger = propertychanged.

When I select a time in the dropdrownlist everything works the way it should. This is the namespace of the toolkit.

xmlns:xctk="clr-namespace:Xceed.Wpf.Toolkit;assembly=WPFToolkit.Extended"

This is the xaml for the timepicker

  <xctk:TimePicker  Format="LongTime" TimeInterval="00:15:00.000" Value="{Binding Path=StartTime, UpdateSourceTrigger=PropertyChanged}" ></xctk:TimePicker>

If I click outside the WPFusercontrol without changing the focus to another control in the wpf usercontrol first. The Binded time is not updated.

Any idea how I can fix this?

解决方案

Found a solution for this problem: I've given the TimePicker a name (In this case 'tpFrom') then I've used the TextBoxBase.TextChanged event on the TimePicker. This is what the Xaml looks like now:

<xctk:TimePicker Name="tpFrom"  Format="LongTime"  TextBoxBase.TextChanged="TimePicker_TextChanged"  TimeInterval="00:15:00.000" Value="{Binding Path=StartTime, UpdateSourceTrigger=PropertyChanged}"></xctk:TimePicker>

In the code behind in our eventhandler we'll put the focus on our timepicker.

  private void TimePicker_TextChanged(object sender, TextChangedEventArgs e)
    {
        tpFrom.Focus();            
    }

Now everytime the text changes, the value changes as well and the problem is solved :-)

这篇关于Timepicker Updatesourcetrigger = propertychanged不更改值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆