Define Source one time and use it many times

Viewed 62

Currently I am using the below code to Bind to the TextBlock to the Application Settings

<Grid DataSource="{Binding DataContext.CurrentPatient, RelativeSource={RelativeSource AncestorType={x:Type Page}}">
   ...
   ...
   ...
   <TextBlock Text="{Binding Source={StaticResource Settings}, Path=Default.Test}" />
   <TextBox Text="{Binding Source={StaticResource Settings}, Path=Default.CurrentValue}" />
   <TextBlock Text="{Binding Source={StaticResource Settings}, Path=Default.NormalValue}" />
   ...
   ...
   ...
</Grid>

Now I don't want to type Source={StaticResource Settings} in all the textblocks.

In short I want Code-minification. I mean I want my code to be maintainable and reduced.

2 Answers
Related