Advertisement
Sweetening

Clippy For Xbox Concept

Jul 20th, 2024
37
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.84 KB | None | 0 0
  1. ------------------------------------------------------------------------------------
  2. ------------------------------------------------------------------------------------
  3. clippy for the xbox one
  4. ------------------------------------------------------------------------------------
  5. ------------------------------------------------------------------------------------
  6. below is the MainPage.xaml
  7. ------------------------------------------------------------------------------------
  8. ------------------------------------------------------------------------------------
  9. <Page
  10. x:Class="ClippyApp.MainPage"
  11. xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  12. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  13. xmlns:local="using:ClippyApp"
  14. xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
  15. xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
  16. mc:Ignorable="d">
  17.  
  18. <Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
  19. <!-- Clippy Image -->
  20. <Image x:Name="ClippyImage"
  21. Source="ms-appx:///Assets/clippy.gif"
  22. HorizontalAlignment="Right"
  23. VerticalAlignment="Top"
  24. Width="100"
  25. Height="100"
  26. Tapped="ClippyImage_Tapped">
  27. </Image>
  28.  
  29. <!-- Tooltip TextBlock -->
  30. <TextBlock x:Name="Tooltip"
  31. Text="Hi! I'm Clippy. How can I assist you today?"
  32. FontSize="16"
  33. FontWeight="Bold"
  34. Foreground="White"
  35. Background="Black"
  36. Padding="10"
  37. HorizontalAlignment="Right"
  38. VerticalAlignment="Top"
  39. Margin="0,110,10,0"
  40. Visibility="Collapsed"/>
  41. </Grid>
  42. </Page>
  43.  
  44. ------------------------------------------------------------------------------------
  45. ------------------------------------------------------------------------------------
  46. Add Code-Behind Logic in MainPage.xaml.cs
  47. ------------------------------------------------------------------------------------
  48. ------------------------------------------------------------------------------------
  49. using Windows.UI.Xaml.Controls;
  50. using Windows.UI.Xaml.Input;
  51. using Windows.UI.Xaml;
  52.  
  53. namespace ClippyApp
  54. {
  55. public sealed partial class MainPage : Page
  56. {
  57. public MainPage()
  58. {
  59. this.InitializeComponent();
  60. InitializeClippy();
  61. }
  62.  
  63. private void InitializeClippy()
  64. {
  65. // Additional initialization if needed
  66. }
  67.  
  68. private void ClippyImage_Tapped(object sender, TappedRoutedEventArgs e)
  69. {
  70. // Toggle the tooltip visibility
  71. Tooltip.Visibility = Tooltip.Visibility == Visibility.Collapsed ? Visibility.Visible : Visibility.Collapsed;
  72. }
  73. }
  74. }
  75. ------------------------------------------------------------------------------------
  76. ------------------------------------------------------------------------------------
  77. Add Animations If you want to include additional animations or effects
  78. ------------------------------------------------------------------------------------
  79. This code would be xml
  80. ------------------------------------------------------------------------------------
  81. <Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
  82. <!-- Clippy Image with animation -->
  83. <Image x:Name="ClippyImage"
  84. Source="ms-appx:///Assets/clippy.gif"
  85. HorizontalAlignment="Right"
  86. VerticalAlignment="Top"
  87. Width="100"
  88. Height="100">
  89. <Image.RenderTransform>
  90. <TranslateTransform x:Name="ClippyTransform" />
  91. </Image.RenderTransform>
  92. </Image>
  93. </Grid>
  94. ------------------------------------------------------------------------------------
  95. ------------------------------------------------------------------------------------
  96. This is CSHARP
  97. ------------------------------------------------------------------------------------
  98. ------------------------------------------------------------------------------------
  99. using Windows.UI.Xaml.Media.Animation;
  100.  
  101. private void InitializeClippy()
  102. {
  103. var storyboard = new Storyboard();
  104. var translateAnimation = new DoubleAnimation
  105. {
  106. From = 0,
  107. To = 10,
  108. Duration = new Duration(TimeSpan.FromSeconds(1)),
  109. AutoReverse = true,
  110. RepeatBehavior = RepeatBehavior.Forever
  111. };
  112. Storyboard.SetTarget(translateAnimation, ClippyTransform);
  113. Storyboard.SetTargetProperty(translateAnimation, "Y");
  114. storyboard.Children.Add(translateAnimation);
  115. storyboard.Begin();
  116. }
  117. ------------------------------------------------------------------------------------
  118. ------------------------------------------------------------------------------------
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement