Let me tell you my case:
I've got a UserControl with 20 dependency properties. Let's call them DP1, DP2, ..., DP20.
Then, on my screen I need to use 50 of these controls. Each DP is binded to a different path, with similar names: the difference is the postfix. For the first UCs:
<my:UC x:Name="uc1"
DP1="{Binding Path=Propert01_Z01}"
DP2="{Binding Path=Propert02_Z01}"
DP3="{Binding Path=Propert03_Z01}"
DP4="{Binding Path=Propert04_Z01}"
...
DP20="{Binding Path=Propert20_Z01}"
/>
<my:UC x:Name="uc2"
DP1="{Binding Path=Propert01_Z02}"
DP2="{Binding Path=Propert02_Z02}"
DP3="{Binding Path=Propert03_Z02}"
DP4="{Binding Path=Propert04_Z02}"
...
DP20="{Binding Path=Propert20_Z02}"
/>
Actually, UC contains TextBlocks binded to DP1, DP2, and so on.
As you can see is very error prone to write 50 UCs, each one with a similar property in each DP.
I'm looking for a way to create a DP in UC called PostFix. This will be set to a value like Z01, Z02, ..., Z50. Then I'll extend Binding (or use a markup extension) for each DP in UC, in order to rebuild the path. It would be nice if I can set the path in the UC as Property01_XXX, but the extension can replace the path for Propert01_Z01 in the first UC, Propert01_Z02 for the second.
It would be nice to write something like this:
<my:UC x:Name="uc1"
PostFix="Z01"
/>
<my:UC x:Name="uc2"
PostFix="Z02"
/>
Any idea about the better way to resolve this?
Right now, I'm guessing the best is to create in PostFix setter all the bindings for DPs in C#, creating the string for Property Paths.