Intersoft ClientUI 8 > ClientUI Fundamentals > Popup Overview > Popup How-to Topics > How-to: Use UXPopup to Display Information from Data Context |
This example shows you how to use UXPopup to display information from a data context.
You can assign UXPopup to an UIElement along with the predefined set of rules on what mouse action will open or close the UXPopup. When assigning the UIElement you can also add additional information using UXPopup.TargetDataContext, this attached property sets the specified data context to the UXPopup when its opened.
The following code shows how to use UXPopup to display information from a data context.
XAML |
Copy Code
|
---|---|
<UserControl.Resources> <DataTemplate x:Key="ItemTemplate"> <Image Source="{Binding Picture}" Width="100" Height="100" Intersoft:UXPopup.TargetPopup="{Binding ElementName=MyPopup}" Intersoft:UXPopup.TargetDataContext="{Binding DataContext}" Intersoft:UXPopup.TargetMouseEnterAction="ShowPopup" Intersoft:UXPopup.TargetMouseLeaveAction="HidePopup" Intersoft:UXPopup.TargetHideLatency="0.2"/> </DataTemplate> </UserControl.Resources> <Grid x:Name="LayoutRoot" DataContext="{Binding Source={StaticResource SampleDataSource}}"> <Intersoft:UXPopup x:Name="MyPopup" HorizontalAlignment="Left" VerticalAlignment="Top" PreferredPosition="Bottom" DisableOverlay="True"> <Grid Background="WhiteSmoke"> <StackPanel Margin="8"> <TextBlock Text="{Binding ContactName}"/> <TextBlock Text="{Binding EmailAddress}"/> </StackPanel> </Grid> </Intersoft:UXPopup> <Intersoft:UXItemsControl HorizontalAlignment="Center" VerticalAlignment="Center" Orientation="Horizontal" ItemTemplate="{StaticResource ItemTemplate}" ItemsSource="{Binding Collection}"> </Intersoft:UXItemsControl> </Grid> |