2
голосов
1ответов
2093 просмотров

Добавление нескольких метаданных свойств к свойству зависимости в действии рабочего процесса

Я создаю ряд настраиваемых действий в Windows Workflow, и мне нужно добавить DependencyProperty, которое может перечислить ряд значений для этого свойства, которые пользователь может затем выбрать при использовании действия. напримерВерно или неверно. Я знаю, как просто передать значение...

0
голосов
2ответов
3770 просмотров

Проблема с привязкой свойства зависимостей пользовательского элемента управления Silverlight к свойству модели

У меня есть пользовательский элемент управления навигацией по данным в Silverlight, который открывает дочернее окно, в котором пользователь может вводить критерии поиска, и когда они нажимают «Применить», предполагается, что необходимо обновить связанное свойство в ViewModel (шаблон MVVM). Сс...

41
голосов
2ответов
14870 просмотров

Почему свойства зависимости?

Почему Microsoft пошла по пути создания свойств зависимостей и объектов зависимостей вместо использования отражения и, возможно, атрибутов?

4
голосов
3ответов
6178 просмотров

Как разработать свойство зависимостей WPF для поддержки пути к изображению?

Чтобы описать свою проблему, я создал небольшое приложение. Сначала Usercontrol: <UserControl x:Class="WpfApplication10.UserControl1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" x:Name="This" DataConte...

2
голосов
3ответов
741 просмотров

InvalidOperationException на объекте из выполненного потока

В приложении WPF у меня был поток BackgroundWorker, создающий объект.Назовем объект foo. Фоновый рабочий код: SomeClass foo = new SomeClass(); // Do some operation on foo // Set some dependency property on the main class to foo this.Dispatcher.BeginInvoke(DispatcherPriority.Normal, (S...

0
голосов
1ответов
1017 просмотров

Свойство зависимости WPF не распознается

Я пытаюсь преодолеть ограничение, которое не позволяет мне выполнять привязку к обычным свойствам clr. В решении, которое я использую, используются настраиваемые свойства зависимостей, которые, в свою очередь, изменяют свойства clr. Вот код class BindableTextBox : TextBox { public s...

4
голосов
3ответов
1391 просмотров

How do I see the value of a DependencyProperty in WinDbg?

Using WinDbg and trying to debug a Silverlight application for memory leaks, I come across properties on my objects that are implemented as a DependencyProperty - and when I dump the object in the debugger (WinDbg) I can see the property - that is, I can see the actual static field. How do I see...

0
голосов
1ответов
2577 просмотров

Binding to a UserControl's DependencyProperty

I'm trying to adapt a soltuion for the WPF toolkit's calendar from http://msdn.microsoft.com/en-us/magazine/dd882520.aspx but I'm having problems getting a binding on the usercontrol to work. I've tried using FindAncestor and ElementName, but I just get a binding error. I think it might have som...

3
голосов
4ответов
8363 просмотров

Dependency property not working, trying to set through style setter

I am trying to set up a custom style for my newly made usercontrol, however i am getting the error : "Cannot convert the value in attribute 'Property' to object of type 'System.Windows.DependencyProperty'." I thought i had set up Dependency properties but it seemed this was not the case, so i di...

2
голосов
1ответов
1234 просмотров

WPF - styling a lookless control: How to access dependecy properties of control from second level of ControlTemplates?

I am extending the ItemsControl (class EnhancedItemsControl : ItemsControl), because I want to add several dependecy properties to it - like AlternativeContent which will be displayed when there are no items in collection (think of 'enter a search terms and hit search' label in a itemscontrol for...

4
голосов
1ответов
844 просмотров

Cannot databind DependencyProperty

I have a UserControl with a DependencyProperty. I set it's value in the host window using a data binding expression. However, it doesn't work as expected. Snippet from the user control's codebehind: public class ViewBase : UserControl { public static readonly DependencyProperty ViewModelPro...

1
голосов
1ответов
758 просмотров

Silverlight: Label does not evaluate Binding of custom DependencyProperty

I have a Silverlight 3 Label which I connect to a ComboBox using the Target Property of the Label. According to MSDN the Label class iterates through the targets bindings and searches the sources for meta data to determine the content of the Label. This actually works as long as the target is a ...

1
голосов
1ответов
830 просмотров

I've created an Attached Property, now how do I use it?

I'm trying to determine if Attached Behaviors are something we need in building controls for the forms in our application. Hence, I not only want to know how to create Attached Behaviors but want to see real instances in which they are used to solve problems. I used this MSDN article to create a...

1
голосов
1ответов
1286 просмотров

How can I extend this dependency property example to recreate a DockPanel.Dock="Top"-like dependency property?

I'm trying to get a better understanding of what dependency properties and what they are not. I've built the example below which enables a combobox's choices to change based on how the user moves a slider. In creating this I learned that dependency properties actually have nothing to do with INo...

2
голосов
2ответов
1155 просмотров

Delayed "rendering" of WPF/Silverlight Dependency Properties?

Is there a way to know the first time a Dependency Property is accessed through XAML binding so I can actually "render" the value of the property when needed? I have an object (class derived from Control) that has several PointCollection Dependency Properties that may contain 100's or 1000's of ...

3
голосов
1ответов
2595 просмотров

Is there a better way to self reference a type?

I'm finding lately a lot of code smells related to referencing generic classes in C#. My gripes especially apply to those classes which inherit from DependencyObject and contain DependencyProperties. The basic problem is that when declaring a dependency property one generally references the cur...

0
голосов
1ответов
227 просмотров

Difference among three kinds of dependency properties in .NET Workflow Foundation

In .NET Workflow Foundation, there are three kinds of dependency proprieties: instance properties, meta properties, and attached properties. Can someone explain what the difference and proper usages are? Thanks.

3
голосов
3ответов
3253 просмотров

Bind to an attached behavior on a Storyboard

I have created an attached dependency property for Storyboards, with the intention of enabling me to call a method on my ViewModel when a Storyboard Completed event fires: public static class StoryboardExtensions { public static ICommand GetCompletedCommand(DependencyObject target) { ...

5
голосов
2ответов
4669 просмотров

If we can't bind a MouseBinding's Command, what are we supposed to do?

I would love to be able to use a regular MouseBinding to capture a CTRL-Click event on my TextBlock. Unfortunately the Command property is not a dependency property and I'm using MVVM, so I can't bind it to my viewmodel. How could Microsoft have left out this basic functionality? Are there no ea...

2
голосов
2ответов
1543 просмотров

WPF MVVM and nested Views with dependency properties

I have a parent view that defines a child view in Xaml. The child view has a DependencyProperty that is bound to the parent view's ViewModel. However, that value is also needed by the child view's ViewModel. <custom:Parent> <custom:Child ChildId="{Binding ParentFooId}" ... /> &lt...

1
голосов
2ответов
304 просмотров

What's the point in setting up dependency properties, when PropertyChangedEventHandler does the job?

Currently I have use the following approach to setup change notification on any of my properties that I bind to in xaml: class MyClass : INotifyPropertyChanged { string name; public string Name { get { return name; } set { name = value; ...

2
голосов
2ответов
1191 просмотров

How do I bind to this custom dependency property?

I have a DependencyProperty in my custom UserControl that looks like this: public static readonly DependencyProperty ColumnWidthProperty = DependencyProperty.Register("ColumnWidth", typeof(int), typeof(CallBoard), new PropertyMetadata(150)); public int ColumnWidth { get { return (...

0
голосов
2ответов
340 просмотров

Dependency Property correct usage

i have a wpf control that i'm developing. this control contains and encapsulate another control. i want to expose a property of the inner control to the window that consumes the control. i also want the inner control to perform logic when this property changed. any suggestions?

23
голосов
2ответов
9129 просмотров

Dependency Property dependent on another

How can one register a dependency property whose value is calculated using the value of another dependency property? Because the .NET property wrappers are bypassed by WPF at run-time, one should not include logic in the getters and setters. The solution to that is typically to use PropertyChan...

7
голосов
2ответов
9367 просмотров

Dependency property in app.xaml.cs

I am new to WPF and the below question may look silly for many, please pardon me. How can I create a dependency property in app.xaml.cs? Actually, I tried to created it. The below code, public static DependencyProperty TempProperty = DependencyProperty.Register("Temp", typeof(string...

1
голосов
1ответов
2504 просмотров

Invalid Cast Exception when trying to convert a property of a user control in a binding

I have a user control that has a textbox. I have tried to expose the texbox's Text property by implementing a DependencyProperty with the same name in the UserControl. Thus: public static readonly DependencyProperty TextProperty = DependencyProperty.Register("Text", ...

1
голосов
2ответов
156 просмотров

Can I make a dependency property that's read-only?

I need this dependency property to be accessible for read operations only. Outside objects should not be able to assign values to it.

4
голосов
4ответов
1413 просмотров

How can I create a custom *write-only* dependency-property?

I need to know what the procedure is for making a write-only dependency-property. I can see that the DependencyProperty class does not have a special "Register" method for write-only properties, but I have no idea whether the RegisterAttached method may apply to what I am trying to do. This pr...

12
голосов
1ответов
6003 просмотров

How can I add logic to an existing dependency-property callback?

I'm trying to add a PropertyChangedCallback to UIElement.RenderTransformOriginProperty. An exception is thrown when I try to override the PropertyMetadata. I have searched MSDN and Google, and all I have been able to come up with is this. DependencyPropertyDescriptor.AddValueChanged is suggest...

1
голосов
1ответов
410 просмотров

Is it possible to "cancel" a dependency-property assignment from an IValueConverter, if there was no change in the property value?

I have a data-binding set on a dependency property of a class. I also have an IValueConverter to handle the calculation of this value based on other elements. The context of my question is inside the IValueConverter.Convert method. #1 If the calculated return value is equal to the current prop...