Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > ActiveX COM > MarkupLabel Control
  New Posts New Posts RSS Feed - Markup Expander code sample
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Markup Expander code sample

 Post Reply Post Reply
Author
Message
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Topic: Markup Expander code sample
    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
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.141 seconds.