Skip to content

Instantly share code, notes, and snippets.

@timheuer
Created September 12, 2012 05:25
Show Gist options
  • Save timheuer/3704450 to your computer and use it in GitHub Desktop.
Save timheuer/3704450 to your computer and use it in GitHub Desktop.
diff --git a/src/Callisto.TestApp/SamplePages/SettingsContent.xaml b/src/Callisto.TestApp/SamplePages/SettingsContent.xaml
index 711fc5c..34f30c9 100644
--- a/src/Callisto.TestApp/SamplePages/SettingsContent.xaml
+++ b/src/Callisto.TestApp/SamplePages/SettingsContent.xaml
@@ -30,6 +30,8 @@ Nunc bibendum accumsan nisi sed fermentum. Integer nec sem mauris. Cum sociis na
Ut eu dui mauris, nec semper urna. Donec tortor enim, blandit id euismod at, porttitor ut justo. Duis euismod magna ac ipsum tristique blandit. Suspendisse at nisi purus. Pellentesque et quam in arcu ultrices placerat. Sed sodales, dui a dapibus malesuada, leo nulla luctus magna, ut vulputate turpis urna in ligula. Nulla gravida enim euismod nulla eleifend cursus. Vestibulum fermentum mi ut erat pulvinar vehicula sagittis libero pulvinar. Suspendisse lacinia risus gravida lectus auctor quis varius purus ultricies. Maecenas vulputate convallis dui ut semper. Morbi diam elit, volutpat vel convallis vel, gravida ut est.
</TextBlock.Text>
</TextBlock>
+ <TextBlock Text="Enter name..." FontSize="14.667" />
+ <TextBox Width="300" Height="55" />
</StackPanel>
</Grid>
</UserControl>
diff --git a/src/Callisto/Controls/Flyout/Flyout.cs b/src/Callisto/Controls/Flyout/Flyout.cs
index 94aeb0a..6bfc223 100644
--- a/src/Callisto/Controls/Flyout/Flyout.cs
+++ b/src/Callisto/Controls/Flyout/Flyout.cs
@@ -119,6 +119,24 @@ private void OnHostPopupOpened(object sender, object e)
Measure(new Size(Double.PositiveInfinity, double.PositiveInfinity));
PerformPlacement(this.HorizontalOffset, this.VerticalOffset);
+
+ // handling the case where it isn't parented to the visual tree
+ // inspect the visual root and adjust.
+ if (_hostPopup.Parent == null)
+ {
+ int ihmOffset = 0;
+
+ Windows.UI.ViewManagement.InputPane.GetForCurrentView().Showing += ((s, a) =>
+ {
+ ihmOffset = (int)a.OccludedRect.Height;
+ _hostPopup.VerticalOffset -= ihmOffset;
+ });
+
+ Windows.UI.ViewManagement.InputPane.GetForCurrentView().Hiding += ((s, a) =>
+ {
+ _hostPopup.VerticalOffset += ihmOffset;
+ });
+ }
}
private static Rect GetBounds(params Point[] interestPoints)
diff --git a/src/Callisto/Controls/Settings/SettingsFlyout.cs b/src/Callisto/Controls/Settings/SettingsFlyout.cs
index baa8f18..eaa965e 100644
--- a/src/Callisto/Controls/Settings/SettingsFlyout.cs
+++ b/src/Callisto/Controls/Settings/SettingsFlyout.cs
@@ -120,6 +120,22 @@ private void OnLoaded(object sender, RoutedEventArgs e)
// ensure it comes from the correct edge location
_hostPopup.SetValue(Canvas.LeftProperty, SettingsPane.Edge == SettingsEdgeLocation.Right ? (_windowBounds.Width - _settingsWidth) : 0);
+
+ // handling the case where it isn't parented to the visual tree
+ // inspect the visual root and adjust.
+ if (_hostPopup.Parent == null)
+ {
+ int ihmOffset = 0;
+ Windows.UI.ViewManagement.InputPane.GetForCurrentView().Showing += ((s, a) =>
+ {
+ ihmOffset = (int)a.OccludedRect.Height;
+ _hostPopup.VerticalOffset -= ihmOffset;
+ });
+ Windows.UI.ViewManagement.InputPane.GetForCurrentView().Hiding += ((s, a) =>
+ {
+ _hostPopup.VerticalOffset += ihmOffset;
+ });
+ }
}
private void OnBackButtonTapped(object sender, object e)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment