2010-04-28 4 views
0

Это мой файл xaml.Silverlight для встроенных окон

<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> 

Вышеупомянутое представляет собой файл XAML построен с использованием Microsoft Expression Blend 2

Я должен использовать этот XAML-файл в качестве ресурса в моем подпроекта с использованием Visual Studio (C++). Для этого мне нужно разработать код C++. Но я очень незнакома с этой технологией, и мне нужно руководствоваться этой задачей.

Пожалуйста, скажите мне, где я могу узнать разработать C++ код для этого XAML файла. Я слышал, что у silverlight есть свой собственный API, который полностью отличается от API WIN32. Я знаком с использованием WIN32 API, но не знаком с этим Silverlight Technology.

Пожалуйста, руководство меня шаг или сайта учебника, где я могу узнать следующие понятия:

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

для экс: - Как написать C++ кода для Windows Embedded для файла XAML, который будет отображаться изображения , который действует как кнопка в эмуляторе?

ответ

1

привет вы можете обратиться по следующим ссылкам, чтобы узнать о Silverlight для Windows Embedded это будет поддерживать только машинный код (C++)

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

http://aimidas.spaces.live.com/blog/cns!4585C53D5F64E56B!1479.entry вам может преобразовать ваш файл xaml в файл C++ с помощью XAML2CPP, вы можете получить его по следующей ссылке

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

после того, как вы можете создать проект, используя win32 проект смарт-устройства с помощью Visual Studio

 Смежные вопросы

  • Нет связанных вопросов^_^