Markup Expander code sample |
Post Reply |
Author | |
Oleg
Admin Group Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
Posted: 26 August 2010 at 4:36pm |
Hi,
Here sample XAML to create Markup Expander <Page xmlns='http://schemas.microsoft.com/winfx/2006/xaml/presentation' xmlns:x='http://schemas.microsoft.com/winfx/2006/xaml'> <ScrollViewer> <StackPanel Background="#FFEFF3FE"> <Border> <Border Margin="16, 16, 16, 16" VerticalAlignment="Top"> <Grid> <Grid.RowDefinitions> <RowDefinition Height="Auto"/> <RowDefinition Height="*"/> </Grid.RowDefinitions> <Border CornerRadius="10, 10, 0, 0" BorderThickness="1" BorderBrush="#799eda" Cursor="Hand" MouseLeftButtonDown="ToggleNextControl"> <Border.Background> <LinearGradientBrush EndPoint="1, 0.5" StartPoint="0, 0.5"> <GradientStop Color="#FFCDDCFE" Offset="0"/> <GradientStop Color="#FFEDF2FE" Offset="1"/> </LinearGradientBrush> </Border.Background> <TextBlock Text="Resources" Foreground="#FF636366" FontWeight="Bold" FontSize="14" Margin="12,2,0,2"/> </Border> <Border Grid.Row="1" Margin="0, -1, 0, 0" Background="White" CornerRadius="0, 0, 10, 10" BorderThickness="1" BorderBrush="#799eda"> <StackPanel Margin="6"> <TextBlock Margin="5" TextWrapping="Wrap"><Hyperlink Foreground="#2118d5"><Run>Get the latest security and virus information from Microsoft</Run></Hyperlink></TextBlock> <TextBlock Margin="5" TextWrapping="Wrap"><Hyperlink Foreground="#2118d5"><Run>Check for the latest updates from Windows Update</Run></Hyperlink></TextBlock> <TextBlock Margin="5" TextWrapping="Wrap"><Hyperlink Foreground="#2118d5"><Run>Get support for secutity-related issues</Run></Hyperlink></TextBlock> <TextBlock Margin="5" TextWrapping="Wrap"><Hyperlink Foreground="#2118d5"><Run>Get help about Security Center</Run></Hyperlink></TextBlock> <TextBlock Margin="5" TextWrapping="Wrap"><Hyperlink Foreground="#2118d5"><Run>Change the way Security Center alerts me</Run></Hyperlink></TextBlock> </StackPanel> </Border> </Grid> </Border> </Border> <Border> <Border Margin="16, 0, 16, 16" VerticalAlignment="Top"> <Grid> <Grid.RowDefinitions> <RowDefinition Height="Auto"/> <RowDefinition Height="*"/> </Grid.RowDefinitions> <Border CornerRadius="10, 10, 0, 0" BorderThickness="1" BorderBrush="#799eda" Cursor="Hand" MouseLeftButtonDown="ToggleNextControl"> <Border.Background> <LinearGradientBrush EndPoint="1, 0.5" StartPoint="0, 0.5"> <GradientStop Color="#FFCDDCFE" Offset="0"/> <GradientStop Color="#FFEDF2FE" Offset="1"/> </LinearGradientBrush> </Border.Background> <TextBlock Text="More Resources" Foreground="#FF636366" FontWeight="Bold" FontSize="14" Margin="12,2,0,2"/> </Border> <Border Grid.Row="1" Margin="0, -1, 0, 0" Background="White" CornerRadius="0, 0, 10, 10" BorderThickness="1" BorderBrush="#799eda"> <StackPanel Margin="6"> <TextBlock Margin="5" TextWrapping="Wrap"><Hyperlink Foreground="#2118d5"><Run>Get the latest security and virus information from Microsoft</Run></Hyperlink></TextBlock> <TextBlock Margin="5" TextWrapping="Wrap"><Hyperlink Foreground="#2118d5"><Run>Check for the latest updates from Windows Update</Run></Hyperlink></TextBlock> <TextBlock Margin="5" TextWrapping="Wrap"><Hyperlink Foreground="#2118d5"><Run>Get support for secutity-related issues</Run></Hyperlink></TextBlock> <TextBlock Margin="5" TextWrapping="Wrap"><Hyperlink Foreground="#2118d5"><Run>Get help about Security Center</Run></Hyperlink></TextBlock> <TextBlock Margin="5" TextWrapping="Wrap"><Hyperlink Foreground="#2118d5"><Run>Change the way Security Center alerts me</Run></Hyperlink></TextBlock> </StackPanel> </Border> </Grid> </Border> </Border> </StackPanel> </ScrollViewer> </Page> Also to allow expand/collapse with mouse down add in VB code Public Sub ToggleNextControl(ByVal Element As MarkupVisual, ByVal Args As Object) Dim Panel As MarkupPanel Set Panel = Element.VisualParent Dim NextElement As MarkupVisual Set NextElement = Panel.Children(1) NextElement.Visibility = IIf(NextElement.Visibility = xtpMarkupVisibilityVisible, xtpMarkupVisibilityCollapsed, xtpMarkupVisibilityVisible) End Sub Private Sub Form_Load() MarkupLabel1.MarkupContext.SetHandler Me End Sub |
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |