Dependency Property

Topics: Prism v4 - WPF 4
Jul 2, 2010 at 9:10 PM

Hello everybody,

First, excuse me for my poor English :-).

I'm beginning in PRISM V4 in WPF Application and MVVM Design Pattern.

I want to know how and where (View or VM ?) declare a DP ?

Thanxs for your Help.

 

Jul 8, 2010 at 3:16 PM

Hi,

As this is something not strictly related with Prism, I thought you could take a look at this documentation on MSDN about Dependency Properties, where you can find some code samples on how to declare and use Dependency Properties.

Please let me know if this helps.

Fernando Antivero
http://blogs.southworks.net/fantivero

Jul 8, 2010 at 5:14 PM
Hello Fantivero,

thanxs a lot for your answer and links. Between the time where I post on codeplex I find solution and it's work.

I know your link but ... in French because my English is not very good ;-)

But I ask me a question : where declare my DP, in View or ViewModel ? This question is more MVVM point of view.

Do you have some guidance, feedback for me about it ?

 

2010/7/8 fantivero <notifications@codeplex.com>

From: fantivero

Hi,

As this is something not strictly related with Prism, I thought you could take a look at this documentation on MSDN about Dependency Properties, where you can find some code samples on how to declare and use Dependency Properties.

Please let me know if this helps.

Fernando Antivero
http://blogs.southworks.net/fantivero

Read the full discussion online.

To add a post to this discussion, reply to this email (CompositeWPF@discussions.codeplex.com)

To start a new discussion for this project, email CompositeWPF@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe on CodePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at CodePlex.com


Jul 9, 2010 at 9:35 PM

koala59230,

You didn't completely describe what you are trying to accomplish, so it is difficult to answer the question.

In general:

1. Because a View has no code in it, you probably want to declare the DP in the ViewModel.

2. If you want to bind an element in the View to the DP, again you would put the DP in the ViewModel because the DP would be a binding source.

You could also review the following to understand DP more:

Binding Sources Overview

How to: Make Data Available for Binding in XAML

How to: Specify the Binding Source

How to: Bind the Properties of Two Controls

Custom Dependency Properties - When Should You Implement a Dependency Property?

Good luck!