Print Page | Close Window

Markup Expander code sample

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: MarkupLabel Control
Forum Description: Topics Related to Codejock MarkupLabel Control
URL: http://forum.codejock.com/forum_posts.asp?TID=17166
Printed Date: 13 May 2024 at 6:48pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Markup Expander code sample
Posted By: Oleg
Subject: Markup Expander code sample
Date 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



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net