dependency-properties

Binding InputValidation additional data using DependencyProperty

[亡魂溺海] 提交于 2019-12-25 03:14:13
问题 kind of missing here something: I'm using input Validation in a datatemplate (which works) and need to supply additional data to the validation (which doesn't work). Using "hard-coded" values (see comment in code below) works, using the binding doesn't. The datatemplate is applied to elements (which have a "value", "low_lim" and "high_lim" properties) displayed in an listView (this also works). I think I just can't wrap my head around binding. May be I just looked to long at this problem. If

Pausing an animation rotation, setting the angle value, then resuming later?

守給你的承諾、 提交于 2019-12-24 21:53:56
问题 I have a situation where I have a 3d Model that has a constant rotation animation. When a user touches the screen, I would like the rotation to stop, and the user's control to take over the animation of the rotation. I tried to do this by pausing the animation, setting the angle property of the rotation locally, then resuming the rotation. However, I discovered due to dependency property precedence, my setting values is ignored while the animation is paused. The only workaround I could come

How can I ensure closed dialogs are unregistered from INPC events?

ε祈祈猫儿з 提交于 2019-12-24 11:56:55
问题 I have an MVVM-Light based WPF application, with a dialog service (called WindowManager ) that opens up dialog windows bound to pre-initiated dialog view-models, like this: private enum ViewModelKind { PlanningGridVM, InputDialogVM, TreeViewDialogVM, SaveFileDialogVM, MessageBoxVM } /// <summary> /// Shows the Window linked to this ViewModel as a dialog window. /// </summary> /// <typeparam name="TViewModel">The type of the view model.</typeparam> /// <returns>Tri-state boolean dialog

Combine dependency properties

 ̄綄美尐妖づ 提交于 2019-12-24 11:14:33
问题 I've done a few WPF projects now and see the same problem pop up and that is the "problem" of aggregating/combining dependency properties (dp's). For example, I have 10 dp's of type bool that I want to combine and expose as a seperated dp. The combined dp is true unless one or more its constituents is false. I currently do this using the addValueChanged which registers a callback for each of the 10 (!() dp's but am wondering if there are more elegant solutions or maybe a framework that

Combine dependency properties

拟墨画扇 提交于 2019-12-24 11:13:50
问题 I've done a few WPF projects now and see the same problem pop up and that is the "problem" of aggregating/combining dependency properties (dp's). For example, I have 10 dp's of type bool that I want to combine and expose as a seperated dp. The combined dp is true unless one or more its constituents is false. I currently do this using the addValueChanged which registers a callback for each of the 10 (!() dp's but am wondering if there are more elegant solutions or maybe a framework that

Silverlight DependencyProperty.SetCurrentValue Equivalent

谁都会走 提交于 2019-12-24 03:19:30
问题 I'm looking for a SL4 equivalent to .NET 4's SetCurrentValue API, which would appear to be exactly what I need for my scenario. In short, I'm writing an attached behavior that updates the value of a given property at appropriate times. However, I don't want it to overwrite any bindings that are set on that dependency property. I merely want to push that value to the property (and therefore have any bindings refresh based on that value). From what I can tell, there's no easy way to do this yet

Should ViewModel inherit DependencyObject in WPF?

冷暖自知 提交于 2019-12-23 20:00:24
问题 I tried to create a simple UserControl in WPF using MVVM. Now I need to create a dependency property for the UserControl , so I tried to create the dependency property in UserControlViewModel (I don't want to be in code-behind). In order to create a dependency property in UserControlViewModel I need to inherit from DependencyObject . Is it a good practice to inherit DependencyObject in UserControlViewModel ? That is, is it a good way to follow MVVM for designing a UserControl ? 回答1: If you

WPF - IsEnabled Binding to DependencyProperty not working properly

别来无恙 提交于 2019-12-23 13:09:05
问题 I have a dependency property defined in my window as below: public static readonly DependencyProperty IsGenericUserProperty = DependencyProperty.Register("IsGenericUser", typeof (bool), typeof (MainWindow)); public bool IsGenericUser { get { return (bool) GetValue(IsGenericUserProperty); } set { SetValue(IsGenericUserProperty, value); } } On my window's constructor I set the data context of the container holding the button: QuickListButtonsStackPanel.DataContext = this; I am binding the

How to fire a command on double-click listbox item using MVVM?

馋奶兔 提交于 2019-12-23 07:47:44
问题 I'm trying to launch an ICommand when the user double-clicks on a listbox item. Also, I'm trying to do this using the MVVM pattern. In this XAML, the key press "p" works perfectly. When I double click on the list box, the command never starts. I've set a break point to confirm "PlayVideoCommand" is not called with a double-click. Am I missing something or do I have to use Setter (which I'm not familiar with)? <ListBox Name="SmallVideoPreviews" Grid.Column="1" MaxHeight="965" ItemsSource="

How to get a DependencyProperty by name in Silverlight?

我的未来我决定 提交于 2019-12-23 07:09:47
问题 Situation: I have a string that represents the name of a DependencyProperty of a TextBox in Silverlight. For example: "TextProperty". I need to get a reference to the actual TextProperty of the TextBox, which is a DependencyProperty. Question: how do I get a reference to a DependencyProperty (in C#) if all I got is the name of the property? Things like DependencyPropertyDescriptor are not available in Silverlight. It seems I have to resort to reflection to get the reference. Any suggestions?