I have a map with hotspots for each state (done in Expression Blend). I capture each MouseEnter of the state (1 thru 50). I pass that into my Domain Data Source:
Dim activebox As Path = TryCast(sender, Path)
activebox.Fill = mouseOverColor
Dim StateID As Integer = CInt(Right(activebox.Name, 2))
Dim _StateContext As New StateContext
myDataGrid.ItemsSource = _StateContext.States
_StateContext.Load(_StateContext.GetStateByStateIDQuery(StateID.Text))
The above works fine for a datagrid, listbox and even a dataform.
But I created a popup with a stackpanel that has textblocks.
popupStatesBox.DataContext = ??????????????
popupStatesBox.IsOpen = True 'popup does open but has no data
-- popupStatesBox.xaml
<Popup x:Name="popupStatsBox" Margin="8,35,0,8" DataContext="{Binding}" IsOpen="false" Width="268" HorizontalAlignment="Left"> <StackPanel x:Name="Layout" Background="Black"> <TextBlock x:Name="tbState" Text="{Binding StateName /> <TextBlock x:Name="tbAbbrev" Text="{Binding Abbreviation}" /> </StackPanel> </Popup>
How do I get the textblocks to display the values from the _StateContext.
StackPanel has DataContext but no ItemsSource. What am I missing?