我有一个每个状态都有热点的地图(在Expression Blend中完成)。我捕获每个MouseEnter状态(1到50)。我传递到我的域名资料来源:上述使用域数据源将数据绑定到TextBlock
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))
工作正常,为DataGrid,ListBox和甚至到数据形。
但我创建了一个带有文本块的弹出窗口。
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>
我如何获得的TextBlocks显示从_StateContext值。
StackPanel有DataContext但没有ItemsSource。我错过了什么?
你的工作示例是什么样的?我很努力地想知道如何使用ListBox来代替弹出窗口。 – AnthonyWJones 2009-12-11 21:40:55
当然,州集合已经有你需要的状态数据? – AnthonyWJones 2009-12-11 21:52:42