Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ------------------------------------------------------------------------------------
- ------------------------------------------------------------------------------------
- clippy for the xbox one
- ------------------------------------------------------------------------------------
- ------------------------------------------------------------------------------------
- below is the MainPage.xaml
- ------------------------------------------------------------------------------------
- ------------------------------------------------------------------------------------
- <Page
- x:Class="ClippyApp.MainPage"
- xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
- xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
- xmlns:local="using:ClippyApp"
- xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
- xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
- mc:Ignorable="d">
- <Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
- <!-- Clippy Image -->
- <Image x:Name="ClippyImage"
- Source="ms-appx:///Assets/clippy.gif"
- HorizontalAlignment="Right"
- VerticalAlignment="Top"
- Width="100"
- Height="100"
- Tapped="ClippyImage_Tapped">
- </Image>
- <!-- Tooltip TextBlock -->
- <TextBlock x:Name="Tooltip"
- Text="Hi! I'm Clippy. How can I assist you today?"
- FontSize="16"
- FontWeight="Bold"
- Foreground="White"
- Background="Black"
- Padding="10"
- HorizontalAlignment="Right"
- VerticalAlignment="Top"
- Margin="0,110,10,0"
- Visibility="Collapsed"/>
- </Grid>
- </Page>
- ------------------------------------------------------------------------------------
- ------------------------------------------------------------------------------------
- Add Code-Behind Logic in MainPage.xaml.cs
- ------------------------------------------------------------------------------------
- ------------------------------------------------------------------------------------
- using Windows.UI.Xaml.Controls;
- using Windows.UI.Xaml.Input;
- using Windows.UI.Xaml;
- namespace ClippyApp
- {
- public sealed partial class MainPage : Page
- {
- public MainPage()
- {
- this.InitializeComponent();
- InitializeClippy();
- }
- private void InitializeClippy()
- {
- // Additional initialization if needed
- }
- private void ClippyImage_Tapped(object sender, TappedRoutedEventArgs e)
- {
- // Toggle the tooltip visibility
- Tooltip.Visibility = Tooltip.Visibility == Visibility.Collapsed ? Visibility.Visible : Visibility.Collapsed;
- }
- }
- }
- ------------------------------------------------------------------------------------
- ------------------------------------------------------------------------------------
- Add Animations If you want to include additional animations or effects
- ------------------------------------------------------------------------------------
- This code would be xml
- ------------------------------------------------------------------------------------
- <Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
- <!-- Clippy Image with animation -->
- <Image x:Name="ClippyImage"
- Source="ms-appx:///Assets/clippy.gif"
- HorizontalAlignment="Right"
- VerticalAlignment="Top"
- Width="100"
- Height="100">
- <Image.RenderTransform>
- <TranslateTransform x:Name="ClippyTransform" />
- </Image.RenderTransform>
- </Image>
- </Grid>
- ------------------------------------------------------------------------------------
- ------------------------------------------------------------------------------------
- This is CSHARP
- ------------------------------------------------------------------------------------
- ------------------------------------------------------------------------------------
- using Windows.UI.Xaml.Media.Animation;
- private void InitializeClippy()
- {
- var storyboard = new Storyboard();
- var translateAnimation = new DoubleAnimation
- {
- From = 0,
- To = 10,
- Duration = new Duration(TimeSpan.FromSeconds(1)),
- AutoReverse = true,
- RepeatBehavior = RepeatBehavior.Forever
- };
- Storyboard.SetTarget(translateAnimation, ClippyTransform);
- Storyboard.SetTargetProperty(translateAnimation, "Y");
- storyboard.Children.Add(translateAnimation);
- storyboard.Begin();
- }
- ------------------------------------------------------------------------------------
- ------------------------------------------------------------------------------------
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement