2010-04-28 3 views
0

Ceci est mon fichier xaml.Silverlight pour Windows intégré

<UserControl 
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
x:Class="SilverlightApplication1.Page" 
Width="640" Height="480" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" xmlns:vsm="clr-namespace:System.Windows;assembly=System.Windows"> 
<UserControl.Resources> 
    <Style x:Key="ButtonStyle1" TargetType="Button"> 
     <Setter Property="Template"> 
      <Setter.Value> 
       <ControlTemplate TargetType="Button"> 
        <Grid> 
         <vsm:VisualStateManager.VisualStateGroups> 
          <vsm:VisualStateGroup x:Name="FocusStates"> 
           <vsm:VisualState x:Name="Unfocused"/> 
           <vsm:VisualState x:Name="Focused"/> 
          </vsm:VisualStateGroup> 
          <vsm:VisualStateGroup x:Name="CommonStates"> 
           <vsm:VisualState x:Name="MouseOver"> 
            <Storyboard> 
             <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="image" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleX)"> 
              <SplineDoubleKeyFrame KeyTime="00:00:00" Value="1.207"/> 
             </DoubleAnimationUsingKeyFrames> 
             <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="image" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleY)"> 
              <SplineDoubleKeyFrame KeyTime="00:00:00" Value="1.207"/> 
             </DoubleAnimationUsingKeyFrames> 
             <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="image" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.X)"> 
              <SplineDoubleKeyFrame KeyTime="00:00:00" Value="15.5"/> 
             </DoubleAnimationUsingKeyFrames> 
             <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="image" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.Y)"> 
              <SplineDoubleKeyFrame KeyTime="00:00:00" Value="17.877"/> 
             </DoubleAnimationUsingKeyFrames> 
            </Storyboard> 
           </vsm:VisualState> 
           <vsm:VisualState x:Name="Normal"/> 
           <vsm:VisualState x:Name="Pressed"> 
            <Storyboard> 
             <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="image" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleX)"> 
              <SplineDoubleKeyFrame KeyTime="00:00:00" Value="0.567"/> 
             </DoubleAnimationUsingKeyFrames> 
             <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="image" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleY)"> 
              <SplineDoubleKeyFrame KeyTime="00:00:00" Value="0.567"/> 
             </DoubleAnimationUsingKeyFrames> 
             <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="image" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.X)"> 
              <SplineDoubleKeyFrame KeyTime="00:00:00" Value="-32.5"/> 
             </DoubleAnimationUsingKeyFrames> 
             <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="image" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.Y)"> 
              <SplineDoubleKeyFrame KeyTime="00:00:00" Value="-37.483"/> 
             </DoubleAnimationUsingKeyFrames> 
            </Storyboard> 
           </vsm:VisualState> 
           <vsm:VisualState x:Name="Disabled"/> 
          </vsm:VisualStateGroup> 
         </vsm:VisualStateManager.VisualStateGroups> 
         <Image Source="bounce_media.png" Stretch="Fill" RenderTransformOrigin="0.5,0.5" x:Name="image"> 
          <Image.RenderTransform> 
           <TransformGroup> 
            <ScaleTransform/> 
            <SkewTransform/> 
            <RotateTransform/> 
            <TranslateTransform/> 
           </TransformGroup> 
          </Image.RenderTransform> 
         </Image> 
         <ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/> 
        </Grid> 
       </ControlTemplate> 
      </Setter.Value> 
     </Setter> 
    </Style> 
    <Style x:Key="ButtonStyle2" TargetType="Button"> 
     <Setter Property="Template"> 
      <Setter.Value> 
       <ControlTemplate TargetType="Button"> 
        <Grid> 
         <vsm:VisualStateManager.VisualStateGroups> 
          <vsm:VisualStateGroup x:Name="FocusStates"> 
           <vsm:VisualState x:Name="Unfocused"/> 
           <vsm:VisualState x:Name="Focused"/> 
          </vsm:VisualStateGroup> 
          <vsm:VisualStateGroup x:Name="CommonStates"> 
           <vsm:VisualState x:Name="MouseOver"> 
            <Storyboard> 
             <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="image" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleX)"> 
              <SplineDoubleKeyFrame KeyTime="00:00:00" Value="1.243"/> 
             </DoubleAnimationUsingKeyFrames> 
             <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="image" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleY)"> 
              <SplineDoubleKeyFrame KeyTime="00:00:00" Value="1.243"/> 
             </DoubleAnimationUsingKeyFrames> 
             <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="image" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.X)"> 
              <SplineDoubleKeyFrame KeyTime="00:00:00" Value="18.208"/> 
             </DoubleAnimationUsingKeyFrames> 
             <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="image" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.Y)"> 
              <SplineDoubleKeyFrame KeyTime="00:00:00" Value="21"/> 
             </DoubleAnimationUsingKeyFrames> 
            </Storyboard> 
           </vsm:VisualState> 
           <vsm:VisualState x:Name="Normal"/> 
           <vsm:VisualState x:Name="Pressed"> 
            <Storyboard> 
             <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="image" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleX)"> 
              <SplineDoubleKeyFrame KeyTime="00:00:00" Value="0.6"/> 
             </DoubleAnimationUsingKeyFrames> 
             <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="image" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleY)"> 
              <SplineDoubleKeyFrame KeyTime="00:00:00" Value="0.6"/> 
             </DoubleAnimationUsingKeyFrames> 
             <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="image" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.X)"> 
              <SplineDoubleKeyFrame KeyTime="00:00:00" Value="-30"/> 
             </DoubleAnimationUsingKeyFrames> 
             <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="image" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.Y)"> 
              <SplineDoubleKeyFrame KeyTime="00:00:00" Value="-34.6"/> 
             </DoubleAnimationUsingKeyFrames> 
            </Storyboard> 
           </vsm:VisualState> 
           <vsm:VisualState x:Name="Disabled"/> 
          </vsm:VisualStateGroup> 
         </vsm:VisualStateManager.VisualStateGroups> 
         <Image Source="bounce_photo.png" Stretch="Fill" RenderTransformOrigin="0.5,0.5" x:Name="image"> 
          <Image.RenderTransform> 
           <TransformGroup> 
            <ScaleTransform/> 
            <SkewTransform/> 
            <RotateTransform/> 
            <TranslateTransform/> 
           </TransformGroup> 
          </Image.RenderTransform> 
         </Image> 
         <ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/> 
        </Grid> 
       </ControlTemplate> 
      </Setter.Value> 
     </Setter> 
    </Style> 
</UserControl.Resources> 

<Grid x:Name="LayoutRoot" Background="pink"> 
    <Button Height="173" HorizontalAlignment="Left" Margin="8,0,0,18" Style="{StaticResource ButtonStyle1}" VerticalAlignment="Bottom" Width="150" Content=""/> 
    <Button Height="173" HorizontalAlignment="Right" Margin="0,0,35,18" Style="{StaticResource ButtonStyle2}" VerticalAlignment="Bottom" Width="150" Content=""/>  

</Grid> 

mentionné ci-dessus est un fichier XAML construit en utilisant Microsoft Expression Blend 2

Je dois utiliser ce fichier XAML comme ressource dans mon sous-projet en utilisant Visual Studio (C++). Pour cela je dois développer un code C++. Mais je suis très peu familier avec cette technologie et j'ai besoin de conseils pour obtenir la tâche.

S'il vous plaît aussi me dire où je peux apprendre à développer un code C++ pour ce fichier XAML . J'ai entendu dire que Silverlight a ses propres API qui est entièrement différente de l'API WIN32. Je suis familier en utilisant WIN32 API, mais peu familier avec cette Silverlight Technology.

S'il vous plaît me guider pas à pas ou sur le site de tutoriel où je peux apprendre les concepts suivants:

1. c++ coding in visual studio for SWE where xaml file is added as resource in 
my sub project. 

Ex: - Comment écrire un code C++ pour Windows Embedded pour un fichier XAML qui affichera images qui agit comme un bouton dans l'émulateur?

Répondre

1

salut vous pouvez consulter les liens suivants à savoir sur silverlight pour Windows Embedded ce ne soutiendra que le code natif (C++)

http://geekswithblogs.net/WindowsEmbeddedCookbook/archive/2009/10/01/silverlight-for-embedded-tutorial.aspx

http://aimidas.spaces.live.com/blog/cns!4585C53D5F64E56B!1479.entry vous pouvez convertir votre fichier xaml en fichier C++ en utilisant XAML2CPP vous pouvez l'obtenir à partir du lien suivant

http://cid-9b7b0aefe3514dc5.skydrive.live.com/self.aspx/.Public/XAML2CPP.zip

après que vous pouvez créer un projet en utilisant projet smart device win32 en utilisant Visual Studio

Questions connexes