Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update the sample code to match the actual code #1709

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 17 additions & 13 deletions WinUIGallery/ControlPages/TeachingTipPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,19 @@
<StackPanel HorizontalAlignment="Left">
<local:ControlExample
CSharpSource="TeachingTip/TeachingTipSample1_cs.txt"
HeaderText="Show a targeted TeachingTip on the Toggle Theme button."
HeaderText="Show a targeted TeachingTip on a button."
XamlSource="TeachingTip/TeachingTipSample1_xaml.txt">
<local:ControlExample.Example>
<Grid>
<Button
x:Name="ThemeButton"
Click="TestButtonClick1"
x:Name="TestButton1"
Click="TestButton1Click"
Content="Show TeachingTip" />
<TeachingTip
x:Name="ToggleThemeTeachingTip1"
x:Name="TestButton1TeachingTip"
Title="This is the title"
Subtitle="And this is the subtitle"
Target="{x:Bind ThemeButton}">
Target="{x:Bind TestButton1}">
<TeachingTip.IconSource>
<SymbolIconSource Symbol="Refresh" />
</TeachingTip.IconSource>
Expand All @@ -47,9 +47,11 @@
XamlSource="TeachingTip/TeachingTipSample2_xaml.txt">
<local:ControlExample.Example>
<Grid>
<Button Click="TestButtonClick2" Content="Show TeachingTip" />
<Button
Click="TestButton2Click"
Content="Show TeachingTip" />
<TeachingTip
x:Name="ToggleThemeTeachingTip2"
x:Name="TestButton2TeachingTip"
Title="This is the title"
ActionButtonContent="Action button"
CloseButtonContent="Close button"
Expand All @@ -63,22 +65,24 @@

<local:ControlExample
CSharpSource="TeachingTip/TeachingTipSample3_cs.txt"
HeaderText="Show a targeted TeachingTip with hero content on the Toggle Theme button."
HeaderText="Show a targeted TeachingTip with hero content on a button."
XamlSource="TeachingTip/TeachingTipSample3_xaml.txt">
<local:ControlExample.Example>
<Grid>
<Button
x:Name="HeroButton"
Click="TestButtonClick3"
x:Name="TestButton3"
Click="TestButton3Click"
Content="Show TeachingTip" />
<TeachingTip
x:Name="ToggleThemeTeachingTip3"
x:Name="TestButton3TeachingTip"
Title="This is the title"
PreferredPlacement="Bottom"
Subtitle="And this is the subtitle"
Target="{x:Bind HeroButton}">
Target="{x:Bind TestButton3}">
<TeachingTip.HeroContent>
<Image AutomationProperties.Name="Sunset" Source="/Assets/SampleMedia/sunset.jpg" />
<Image
AutomationProperties.Name="Sunset"
Source="/Assets/SampleMedia/sunset.jpg" />
</TeachingTip.HeroContent>
<TeachingTip.Content>
<TextBlock
Expand Down
12 changes: 6 additions & 6 deletions WinUIGallery/ControlPages/TeachingTipPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,19 @@ public TeachingTipPage()
this.InitializeComponent();
}

private void TestButtonClick1(object sender, RoutedEventArgs e)
private void TestButton1Click(object sender, RoutedEventArgs e)
{
ToggleThemeTeachingTip1.IsOpen = true;
TestButton1TeachingTip.IsOpen = true;
}

private void TestButtonClick2(object sender, RoutedEventArgs e)
private void TestButton2Click(object sender, RoutedEventArgs e)
{
ToggleThemeTeachingTip2.IsOpen = true;
TestButton2TeachingTip.IsOpen = true;
}

private void TestButtonClick3(object sender, RoutedEventArgs e)
private void TestButton3Click(object sender, RoutedEventArgs e)
{
ToggleThemeTeachingTip3.IsOpen = true;
TestButton3TeachingTip.IsOpen = true;
}
}
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
<Button Content="Show TeachingTip" Click="TestButtonClick1" />

<TeachingTip x:Name="ToggleThemeTeachingTip1"
Target="{x:Bind ThemeButton}"
Title="Change themes without hassle"
Subtitle="It's easier than ever to see control samples in both light and dark theme!">
<Button
x:Name="TestButton1"
Click="TestButton1Click"
Content="Show TeachingTip" />
<TeachingTip
x:Name="TestButton1TeachingTip"
Title="This is the title"
Subtitle="And this is the subtitle"
Target="{x:Bind TestButton1}">
<TeachingTip.IconSource>
<SymbolIconSource Symbol="Refresh" />
</TeachingTip.IconSource>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<Button Content="Show TeachingTip" Click="TestButtonClick2" />

<TeachingTip x:Name="ToggleThemeTeachingTip2"
Title="Change themes without hassle"
Subtitle="It's easier than ever to see control samples in both light and dark theme!"
PreferredPlacement="Auto"
PlacementMargin="20"
IsLightDismissEnabled="True"
ActionButtonClick="ToggleThemeTeachingTip2_ActionButtonClick"
ActionButtonContent="Toggle theme now"
CloseButtonContent="Got it!">
</TeachingTip>
<Button
Click="TestButton2Click"
Content="Show TeachingTip" />
<TeachingTip
x:Name="TestButton2TeachingTip"
Title="This is the title"
ActionButtonContent="Action button"
CloseButtonContent="Close button"
IsLightDismissEnabled="True"
PlacementMargin="20"
PreferredPlacement="Auto"
Subtitle="And this is the subtitle" />
Original file line number Diff line number Diff line change
@@ -1,14 +1,22 @@
<Button Content="Show TeachingTip" Click="TestButtonClick3" />

<TeachingTip x:Name="ToggleThemeTeachingTip3"
Target="{x:Bind ThemeButton}"
Title="Change themes without hassle"
Subtitle="It's easier than ever to see control samples in both light and dark theme!"
PreferredPlacement="LeftEdgeAlignedBottom">
<Button
x:Name="TestButton3"
Click="TestButton3Click"
Content="Show TeachingTip" />
<TeachingTip
x:Name="TestButton3TeachingTip"
Title="This is the title"
PreferredPlacement="Bottom"
Subtitle="And this is the subtitle"
Target="{x:Bind TestButton3}">
<TeachingTip.HeroContent>
<Image Source="/Assets/SampleMedia/sunset.jpg" AutomationProperties.Name="Sunset" />
<Image
AutomationProperties.Name="Sunset"
Source="/Assets/SampleMedia/sunset.jpg" />
</TeachingTip.HeroContent>
<TeachingTip.Content>
<TextBlock TextWrapping="WrapWholeWords" Margin="0,16,0,0">To change your desktop theme visit the <Hyperlink NavigateUri="ms-settings:colors">Settings app</Hyperlink>.</TextBlock>
<TextBlock
Margin="0,16,0,0"
Text="Description can go here"
TextWrapping="WrapWholeWords" />
</TeachingTip.Content>
</TeachingTip>