I use Mvvm-Light and ignore how the XAML binding really works so far.
Here is my xaml
<phone:PhoneApplicationPage.Resources>
</phone:PhoneApplicationPage.Resources>
<Grid x:Name="LayoutRoot" Background="Transparent">
<StackPanel x:Name="TitlePanel" Grid.Row="0" Margin="12,17,0,14">
<TextBlock x:Name="ApplicationTitle" Text="{Binding SecuritySystemName}" Style="{StaticResource PhoneTextNormalStyle}"/>
<TextBlock x:Name="PageTitle" Text="{Binding PageName}" Margin="9,-7,0,0" Style="{StaticResource PhoneTextTitle1Style}"/>
</StackPanel>
<TextBlock Name="textCode"
DataContext="{WHAT GOES HERE to bind to properties on my View (SecurityPanelPage class)}"
Text="{Binding Path=Code}" />
</Grid>
{Binding SecuritySystemName} and {Binding PageName} are correctly bound to my ViewModel (SecuirtyPanelViewModel). But I want to {Binding Code} in the TextBlock element to be attached to my VIEW (and not ViewModel).
I searched and searched for documentation and samples that explain the syntax and values supported by DataContext and Binding. Nothing helped.
, , DataContext ( - {Binding...}, View. "" "RelativeSource", . , XAML .
.
- , , , .
:
<phone:PhoneApplicationPage x:Name="ThisPage">
<TextBlock Name="textCode" Text="{Binding Code, ElementName=ThisPage"/>
</phone:PhoneApplicationPage>
: http://bursjootech.blogspot.com/2007/12/bind-from-xaml-to-local-property-in.html
-: " XAML ".
, . , ...