Solved! Go to Solution.
// Find FeatureDataGridContainer ContentControl attribPanel = MapApplication.Current.FindObjectInLayout("FeatureDataGridContainer") as ContentControl; if (attribPanel != null) { Storyboard storyBoard; // Check whether the control needs to be shown or hidden if (attribPanel.Visibility == Visibility.Collapsed) { // Check whether the side panel has a visual state called Show. If so, we'll show the side // panel by invoking the storyboard from this state. storyBoard = VisualStateManagerHelper.FindVisualStateStoryboard(attribPanel, null, "Show", true); if (storyBoard != null) storyBoard.Begin(); else // The side panel does not have a Show state, so set the panel's visibility directly attribPanel.Visibility = Visibility.Visible; } else { // The toggle button is being clicked when the control is already visible. So the click should hide it. // Check whether the side panel has a visual state called Hide. If so, we'll hide the side // panel by invoking the storyboard from this state. storyBoard = VisualStateManagerHelper.FindVisualStateStoryboard(attribPanel, null, "Hide", true); if (storyBoard != null) storyBoard.Begin(); else // The side panel does not have a Hide state, so set the panel's visibility directly attribPanel.Visibility = Visibility.Collapsed; } }
// Find FeatureDataGridContainer ContentControl attribPanel = MapApplication.Current.FindObjectInLayout("FeatureDataGridContainer") as ContentControl; if (attribPanel != null) { Storyboard storyBoard; // Check whether the control needs to be shown or hidden if (attribPanel.Visibility == Visibility.Collapsed) { // Check whether the side panel has a visual state called Show. If so, we'll show the side // panel by invoking the storyboard from this state. storyBoard = VisualStateManagerHelper.FindVisualStateStoryboard(attribPanel, null, "Show", true); if (storyBoard != null) storyBoard.Begin(); else // The side panel does not have a Show state, so set the panel's visibility directly attribPanel.Visibility = Visibility.Visible; } else { // The toggle button is being clicked when the control is already visible. So the click should hide it. // Check whether the side panel has a visual state called Hide. If so, we'll hide the side // panel by invoking the storyboard from this state. storyBoard = VisualStateManagerHelper.FindVisualStateStoryboard(attribPanel, null, "Hide", true); if (storyBoard != null) storyBoard.Begin(); else // The side panel does not have a Hide state, so set the panel's visibility directly attribPanel.Visibility = Visibility.Collapsed; } }