Skip to content

Commit 0df9b34

Browse files
committed
Fixing UI
1 parent 7182a2b commit 0df9b34

File tree

3 files changed

+20
-1
lines changed

3 files changed

+20
-1
lines changed

Microsoft.Toolkit.Uwp.SampleApp/SamplePages/PrintHelper/PrintHelperPage.xaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
<Grid.RowDefinitions>
1919
<RowDefinition />
2020
<RowDefinition Height="Auto" />
21+
<RowDefinition Height="Auto" />
2122
</Grid.RowDefinitions>
2223
<Grid x:Name="Container"
2324
Grid.RowSpan="2"
@@ -57,6 +58,7 @@
5758
Click="DirectPrint_Click"
5859
Content="Direct Print Me!" />
5960
</StackPanel>
61+
<TextBlock Grid.Row="2" HorizontalAlignment="Center">Direct Print will print the content without removing it from the visual tree (in place).</TextBlock>
6062
</Grid>
6163
</Grid>
6264
</Page>

Microsoft.Toolkit.Uwp.SampleApp/SamplePages/PrintHelper/PrintHelperPage.xaml.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ private async void Print_Click(object sender, Windows.UI.Xaml.RoutedEventArgs e)
3333
_printHelper = new PrintHelper(Container);
3434
_printHelper.AddFrameworkElementToPrint(PrintableContent);
3535

36+
_printHelper.OnPrintCanceled += PrintHelper_OnPrintCanceled;
3637
_printHelper.OnPrintFailed += PrintHelper_OnPrintFailed;
3738
_printHelper.OnPrintSucceeded += PrintHelper_OnPrintSucceeded;
3839

@@ -45,6 +46,7 @@ private async void DirectPrint_Click(object sender, Windows.UI.Xaml.RoutedEventA
4546

4647
_printHelper = new PrintHelper(DirectPrintContainer);
4748

49+
_printHelper.OnPrintCanceled += PrintHelper_OnPrintCanceled;
4850
_printHelper.OnPrintFailed += PrintHelper_OnPrintFailed;
4951
_printHelper.OnPrintSucceeded += PrintHelper_OnPrintSucceeded;
5052

@@ -76,5 +78,10 @@ private async void PrintHelper_OnPrintFailed()
7678
var dialog = new MessageDialog("Printing failed.");
7779
await dialog.ShowAsync();
7880
}
81+
82+
private void PrintHelper_OnPrintCanceled()
83+
{
84+
ReleasePrintHelper();
85+
}
7986
}
8087
}

Microsoft.Toolkit.Uwp.SampleApp/Shell.xaml.cs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,11 @@ private void UpdateRootGridMinWidth()
262262
}
263263

264264
private void ExpandButton_Click(object sender, RoutedEventArgs e)
265+
{
266+
ExpandOrCloseProperties();
267+
}
268+
269+
private void ExpandOrCloseProperties()
265270
{
266271
var states = VisualStateManager.GetVisualStateGroups(HamburgerMenu).FirstOrDefault();
267272
string currentState = states.CurrentState.Name;
@@ -280,7 +285,7 @@ private void ExpandButton_Click(object sender, RoutedEventArgs e)
280285
}
281286
else
282287
{
283-
// ane is closed, so let's open it
288+
// pane is closed, so let's open it
284289
Grid.SetRowSpan(InfoAreaGrid, 2);
285290
Grid.SetRow(InfoAreaGrid, 0);
286291
_isPaneOpen = true;
@@ -341,6 +346,11 @@ private void NavigationFrameOnNavigated(object sender, NavigationEventArgs navig
341346
SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility = NavigationFrame.CanGoBack
342347
? AppViewBackButtonVisibility.Visible
343348
: AppViewBackButtonVisibility.Collapsed;
349+
350+
if (_isPaneOpen)
351+
{
352+
ExpandOrCloseProperties();
353+
}
344354
}
345355

346356
private void HamburgerMenu_OnItemClick(object sender, ItemClickEventArgs e)

0 commit comments

Comments
 (0)