dependency-properties

Why is this Animatable property being set again?

戏子无情 提交于 2019-12-08 06:15:19
问题 Follow up to this question. Apparently, for some reason after having explicitly set the Parent.Child property ( either inside the constructor or explicitly outside of the constructor ), when I set the Child.Trigger property of the Parent.Child object, the Parent.Child object is being set yet again. This can be observed by breaking on the _OnChildChanged method defined within the static constructor. On the second instance of it being called, you can see that e.OldValue is not null, and that it

dependent drop-down in odoo / open erp

允我心安 提交于 2019-12-08 03:45:20
问题 I have made two drop-downs. Second dropdown's data is dependent on first drop-down's chosen value. I have tried multiple methods, but didn't find any relevant solution. Those are my three lists: SELECTION_LIST = (('sela','Selected a'), ('selb','Selected b')) SELECTION_LIST_2 = (('selc','Selected c'), ('seld','Selected d')) SELECTION_LIST_3 = (('sele','Selected e'), ('self','Selected f')) And I defined my fields this way: 'type_selection': fields.selection( [ ('selection1', 'Selection 1'), (

UWP ValueConverter with DependencyProperty

家住魔仙堡 提交于 2019-12-08 03:14:58
问题 I have a UWP project, and I am trying to get a binding on my ValueConverter . It is based on this guide. I have created a DependencyProperty on the ValueConverter , but it is always null , instead of an element of type Vehicle . There is my code: MainPage.xaml <Page x:Class="Project.Pages.MainPage" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http:

Strange error in code converted to VB.NET from C# [duplicate]

跟風遠走 提交于 2019-12-07 23:49:16
问题 This question already has an answer here : Closed 7 years ago . Possible Duplicate: Method group in VB.NET? While reading an answer I got this code: public static class Helper { public static bool GetAutoScroll(DependencyObject obj) { return (bool)obj.GetValue(AutoScrollProperty); } public static void SetAutoScroll(DependencyObject obj, bool value) { obj.SetValue(AutoScrollProperty, value); } public static readonly DependencyProperty AutoScrollProperty = DependencyProperty.RegisterAttached(

Getting Attached property inheritance to propagate

回眸只為那壹抹淺笑 提交于 2019-12-07 17:14:05
问题 I am having trouble getting an attached property value to propagate down the tree from a parent to a child in the visual hierarchy. The setup is as follows: I have a custom panel that instantiates a Viewport3D. The Panel then handles the child added and removed to create and add an inherited Visual3D class for each child item. I am trying to declare an attached property called AttachedToggle property. I would like to have this property reside in an external owner class called AttachedToggle

WPF Dependency Properties: Why do I need to specify an Owner Type?

微笑、不失礼 提交于 2019-12-07 12:16:18
问题 This is how I register a DependencyProperty : public static readonly DependencyProperty UserProperty = DependencyProperty.Register("User", typeof (User), typeof (NewOnlineUserNotifier)); public User User { get { return (User)GetValue(UserProperty); } set { SetValue(UserProperty, value); } } The third parameter of the DependencyProperty.Register method requires you to specify the type of the Control where the Dependency Property resides in (in this case, my User Control is called

Binding a UserControl DP from DataTemplate UWP

本秂侑毒 提交于 2019-12-07 08:34:14
问题 I've got a FlipView that shows Figurines . Figurines contain a Path to their image. Binding this property to a regular DataTemplate is ok. (the code below works fine) </DataTemplate> <Canvas x:Name="DefaultImageCanvas" Width="660" Height="372"> <Image Name="imageFlip" Width="660" Height="372" Source="{Binding Path}" Stretch="Uniform" /> </Canvas> </DataTemplate> But when using my UserControl instead, it doesnt work anymore: <DataTemplate> <local:FigurineStickerUserControl Width="660" Height=

TemplateBinding not working for textbox text

泪湿孤枕 提交于 2019-12-07 05:17:20
问题 I have a custom control called EnhancedTextBox which is a UserControl that has a TextBox and a Button . To the consumer I want it to mostly look like a TextBox, so I did the following: <UserControl.Template> <ControlTemplate TargetType="textBoxes:EnhancedTextBox"> ... <TextBox Text="{TemplateBinding Text}"... And in EnhancedTextBox I have public static readonly DependencyProperty TextProperty = DependencyProperty.Register("Text", typeof (String), typeof (EnhancedTextBox)); public String Text

How is the WPF property system economical?

做~自己de王妃 提交于 2019-12-07 02:59:27
问题 It is said that the designers of WPF have made it economical or higher performance. Can someone please explain with an example of what happens under the hood that makes the WPF property system more economical? 回答1: You are probably referring to the fact that Dependency Properties are "cheaper" than normal CLR properties. In a few words: Dependency properties are implemented using sparse data structures that only allocate memory for the property value if it is set on an object . In contrast, a

Limit attached dependency property in wpf

蓝咒 提交于 2019-12-06 19:29:57
问题 I want to attach a dependency property to specific controls only. If that is just one type, I can do this: public static readonly DependencyProperty MyPropertyProperty = DependencyProperty.RegisterAttached("MyProperty", typeof(object), typeof(ThisStaticWrapperClass)); public static object GetMyProperty(MyControl control) { if (control == null) { throw new ArgumentNullException("control"); } return control.GetValue(MyPropertyProperty); } public static void SetMyProperty(MyControl control,