dependency-properties

Binding from View-Model to View-Model of a child User Control in Silverlight? 2 sources - 1 target

删除回忆录丶 提交于 2020-01-05 08:28:30
问题 So i have a UserControl for one of my Views and have another 'child' UserControl inside that. The outer 'parent' UserControl has a Collection on its View-Model and a Grid control on it to display a list of Items . I want to place another UserControl inside this UserControl to display a form representing the details of one Item . The parent UserControl's View-Model already has a property on it to hold the currently selected Item and i would like to bind this to a DependancyProperty on the

c# uwp tooltip placement property not updating

江枫思渺然 提交于 2020-01-04 14:09:18
问题 In C# UWP I am creating custom tooltip style. I have changed the default style of tooltip as below. <Style TargetType="ToolTip"> <Setter Property="Foreground" Value="White" /> <Setter Property="Background" Value="{ThemeResource SystemControlBackgroundChromeMediumLowBrush}" /> <Setter Property="BorderBrush" Value="{ThemeResource SystemControlForegroundChromeHighBrush}" /> <Setter Property="BorderThickness" Value="{ThemeResource ToolTipBorderThemeThickness}" /> <Setter Property="FontSize" Value

How to Expose multiple DependencyProperties (with same Name) of nested Controls in a UserControl?

♀尐吖头ヾ 提交于 2020-01-04 13:36:25
问题 I tried to solve almost same problem: "How to Expose a DependencyProperty of a Control nested in a UserControl?" The difference is that I have different (2 or more) nested Controls with of the same type . My goal is to make the nested DependencyProperties bindable. The main Problem I am facing is that Binding don't uses the the Getter and Setter of the CLR-Property but the String of the registererd DependencyProperty . With 2 (or more) nested Controls I am facing a naming conflict. To

Add multiple Property Metadata to a Dependency Property in a Workflow Activity

末鹿安然 提交于 2020-01-04 09:39:21
问题 I am building a number of Custom Activities in Windows Workflow and I need to add a DependencyProperty which can list a number of values for that property which the user can then select when using the activity. e.g. True or False. I know how to simply pass a default using the PropertyMetadata, and presume that I will have to pass a list/class now the PropertyMetadata? Has anyone already got an example of how to do this please? (Example Code below) public static DependencyProperty TestProperty

Dependency property in custom control is sharing memory/values unexpectedly

梦想与她 提交于 2020-01-03 20:01:56
问题 I have the following set up: Custom WPF Control (Base class), deriving from Canvas Implementation of that base class An ObservableCollection<T> dependency property on that implementation I have a test app that displays three unique instances of my custom control (e.g. <custom:MyControl x:Name="Test1" /> , Test2, Test3, and so on). When I run and debug the app, the contents of the ObservableCollection<T> are the same for all three instances of the control. Why is this? Chart: [ContentProperty(

Dependency property in custom control is sharing memory/values unexpectedly

烂漫一生 提交于 2020-01-03 20:01:27
问题 I have the following set up: Custom WPF Control (Base class), deriving from Canvas Implementation of that base class An ObservableCollection<T> dependency property on that implementation I have a test app that displays three unique instances of my custom control (e.g. <custom:MyControl x:Name="Test1" /> , Test2, Test3, and so on). When I run and debug the app, the contents of the ObservableCollection<T> are the same for all three instances of the control. Why is this? Chart: [ContentProperty(

C#: Extending from more than 1 class

我与影子孤独终老i 提交于 2020-01-03 13:03:24
问题 Suppose I have a ViewModel TabViewModel that Extends ObservableObject the class for ViewModels in the MVVM Foundation Framework. Then I also have a EditorTabViewModel that extends TabViewModel , Now I need to extend DependencyObject to implement DependencyProperties. I cannot extend more than 1 class. How might I implement this? I could have an "intermediate" class like ... TabViewModel : ObservableObject EditorTabViewModel : TabViewModel DependentEditorTabViewModel : DependencyObject but

WPF Custom Control: DependencyProperty of Collection type

♀尐吖头ヾ 提交于 2020-01-03 10:46:14
问题 I have a CustomControl which contains a ListBox : <UserControl x:Class="WpfApplication1.CustomList" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" mc:Ignorable="d" d:DesignHeight="300" d:DesignWidth="300"> <Grid> <ListBox Name="listBox1" ItemsSource="{Binding ListSource}" /> </Grid> <

WPF, cannot bind a property because it says it's not a DependencyProperty, but I registered it

坚强是说给别人听的谎言 提交于 2020-01-03 03:37:08
问题 I have a UserControl with a Template property that I've set up as a DependencyProperty : public partial class TemplateDetail : UserControl { public static readonly DependencyProperty _templateProperty = DependencyProperty.Register( "Template", typeof(Template), typeof(TemplateDetail) ); public TemplateDetail() { InitializeComponent(); Template = new Template(); DataContext = Template; } public Template Template { get { return (Template)GetValue(_templateProperty); } set { SetValue(

Synchronize Bindings of multiple Properties in a UserControl

故事扮演 提交于 2020-01-02 07:17:13
问题 I have an ugly race condition with a WPF usercontrol, which is some kind of extended ComboBox: The UserControl mainly defines two bindable DependencyProperties, one is the selected item, another one is a list, from which the selected item can be chosen. Both are bindable, so the control may be initialized with or without a selected item and both properties can be changed via binding (on DataContext change), further the selection may change due to user interaction. The UserControl contains a