This project is read-only.

Hiding and showing the slide show description

Nov 30, 2008 at 6:32 PM
Edited Nov 30, 2008 at 6:36 PM

Another change that I wanted to make was to allow the Slide.Show was to provide a way to hide and show the slide description.  The current functionality allows for closing the slide description, but once it is gone, there is no way to bring it back.  This was done by adding an info button to all showing and hiding of the slide description panel.  The InfoButton was added as another PathButton object.  This was accomplished with the following steps.

This ended up being a fairly complex change, but it really allowed me to understand Silverlight and the application better.  This was a much my purpose as adding the new functionality.





Generic.xaml – added a PathButton element called InfoButtonElement just before the GoToFullScreenButtonElement


<v:PathButton x:Name="InfoButtonElement"

      Background1="{TemplateBinding InfoButtonBackground1Brush}"

      Background2="{TemplateBinding InfoButtonBackground2Brush}"

      RadiusX="{TemplateBinding InfoButtonRadiusX}"

      RadiusY="{TemplateBinding InfoButtonRadiusY}"

      Width="{TemplateBinding InfoButtonWidth}"

      Height="{TemplateBinding InfoButtonHeight}"

      PathWidth="{TemplateBinding InfoButtonPathWidth}"

      PathHeight="{TemplateBinding InfoButtonPathHeight}"

      Foreground="{TemplateBinding InfoButtonForegroundBrush}"

      ForegroundHover="{TemplateBinding InfoButtonForegroundHoverBrush}"

      Margin="{TemplateBinding InfoButtonMargin}"

      Visibility="{TemplateBinding InfoViewButtonVisibility}"

      Data="{TemplateBinding InfoButtonPathData}" />


Navigation.cs – added new method ToggleSlideDescription()

public static void ToggleSlideDescription()


    Page page = App.Current.RootVisual as Page;

    if (page != null && page.slideDescription != null)






SlideDescription.cs – added new method ToggleVisibility()

public void ToggleVisibility()


    if (RootElement != null)


        if (RootElement.Visibility == Visibility.Visible)



            RootElement.Visibility = Visibility.Collapsed;




            RootElement.Visibility = Visibility.Visible;






Page.xaml.cs – added event handler for InfoButtonElement

navigationTray.InfoButtonElement.Click += delegate





NavigationTray.cs – Added InfoButtonElement property.  Added info button template code before goToFullScreenButton code. 

internal PathButton _elementInfoButton;

internal const string ElementInfoButtonName = "InfoButtonElement";


public PathButton InfoButtonElement


    get { return _elementInfoButton; }

    set { _elementInfoButton = value; }



object infoButton = GetTemplateChild(ElementInfoButtonName);

Debug.Assert(typeof(PathButton).IsInstanceOfType(infoButton) || (infoButton == null),

    "The template part InfoButtonElement is not an instance of PathButton!");


InfoButtonElement = infoButton as PathButton;


Also added a region for the Dependency Properties which mirrored the FullScreenButton dependency properties region except there is only a single InfoButton rather than a GoToFullScreenButton and an EscapeFullScreenButton.


Added Options values to the NavigationTray constructor


Added InfoButton template attribute

    [TemplatePart(Name = NavigationTray.ElementInfoButtonName, Type = typeof(PathButton))]


Configuration.cs – added configuration options as the ToggleInfoButtonOptions class


XmlConfigurationProvider.cs – added options for the ToggleInfoButton


LightTheme.cs – set default values for the new InfoButton element.  This has to be added to all three themes since the DefaultTheme mechanism doesn’t pick up the changes to LightTheme which is the de facto default theme.

I had added this as an item in the Issue Tracker section as "Slide Description - close button" and now that I've done this, I've attached the modified files to that issue ( if you are interested in getting these changes since they were somewhat tedious to implement.

Now, if you have implemented the XmlCustomProvider mods from the other discussions, you can disable the slide description when the slide show launches with the following added to the customization xml file.



module name="SlideDescription">
option name="Enabled" value="false" />











Jul 6, 2009 at 5:50 AM

Here's another (less elegant, but simpler) solution that actually met my needs perfectly. In SlideDescription.cs, simply remove these lines from the CloseButtonElement_Click method:

if (RootElement != null)
RootElement.Visibility = Visibility.Collapsed;

Now the behavior is that when the user clicks the close button, the description field is hidden, but moving the mouse out of the image and then back into it will bring it right back. That was exactly what I wanted the behavior to be in the first place.

This simplified fix to slidedescription.cs is included in change set 25804. Note that the change set includes additional enhancements and bug fixes as well.