I have a Silverlight object (call it QuestionAsker.xaml) and another object I use as the data context for that silver light page/object (call it QuestionAskerVM.cs) My QuestionAskerVM instance is called QuestionAskerViewModel and is defined in QuestionAsker.xaml.cs.
My QuestionAsker.xaml looks like this:
<UserControl x:Class="IsAProgrammer.QuestionAsker"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d" d:DesignHeight="364" d:DesignWidth="470"
DataContext="{Binding QuestionAskerViewModel}">
<Grid x:Name="LayoutRoot" Background="White">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height=".2*" />
<RowDefinition Height=".7*" />
<RowDefinition Height=".1*" />
</Grid.RowDefinitions>
<TextBlock Grid.Row="0" Margin="5" Text="{Binding CurrentQuestion.QuestionText}"/>
</Grid> ^
</UserControl> |
|
This is the most relevant line ----------------+
That works just fine. The value of QuestionText gets put in the TextBlock. (Note that CurrentQuestion is a Dependancy Property and that QuestionAskerVM is a Dependancy Object.)
The problem is that Visual Studio 2010 has a binding feature (in the properties pane). I click on the little binding icon and it says "Apply Binding".
After I click on that then I get the binding dialog. It has "DataContext - Object" as the first first item in the Source but for my path it says that my Path Could not be Resolved.
What can I do so that Visual Studio 2010 recognizes my Objects.