D3POD Posted May 1, 2012 at 09:30 PM Report #452533 Posted May 1, 2012 at 09:30 PM Boas pessoal, ando a tentar fazer um slide show seguindo este tutorial em expression blend: http://gozoomin.com/blogs/tbarbosa/archive/2010/04/08/tutorial-5-criar-um-slideshow-em-silverlight.aspx O problema está na parte dos states pois crio os states (exemplo 5) mas não sei como definir a imagem a cada um... Alguém me consegue dar uma ajuda? Cumprimentos, Diogo Lamego
petvetbr Posted May 1, 2012 at 10:20 PM Report #452547 Posted May 1, 2012 at 10:20 PM Você simplesmente cria os states e depois com um state selecionado troca a imagem que está no contentGrid, vai fazendo isto para todos os states criados. É só isto. Fernando Lage Bastos - MCP/MCTS/MCPD
D3POD Posted May 1, 2012 at 10:50 PM Author Report #452561 Posted May 1, 2012 at 10:50 PM Eu já fiz isso mas fica sempre o mesmo quando faço RUN (F5)
petvetbr Posted May 1, 2012 at 11:03 PM Report #452566 Posted May 1, 2012 at 11:03 PM Tem como você colocar o código (CS e XAML) desta tela? Fernando Fernando Lage Bastos - MCP/MCTS/MCPD
D3POD Posted May 1, 2012 at 11:15 PM Author Report #452571 Posted May 1, 2012 at 11:15 PM <UserControl xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" x:Class="SilverlightApplication2.MainPage" Width="640" Height="480"> <Grid x:Name="LayoutRoot" Background="White"> <VisualStateManager.VisualStateGroups> <VisualStateGroup x:Name="Teste"> <VisualStateGroup.Transitions> <VisualTransition GeneratedDuration="0:0:0.6"/> </VisualStateGroup.Transitions> <VisualState x:Name="a"/> <VisualState x:Name="b"> <Storyboard> <DoubleAnimation Duration="0:0:1" To="-3" Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.TranslateX)" Storyboard.TargetName="_2" d:IsOptimized="True"/> <DoubleAnimation Duration="0:0:1" To="1.5" Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.TranslateY)" Storyboard.TargetName="_2" d:IsOptimized="True"/> </Storyboard> </VisualState> <VisualState x:Name="c"> <Storyboard> <DoubleAnimation Duration="0:0:2" To="3" Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.TranslateX)" Storyboard.TargetName="_3" d:IsOptimized="True"/> <DoubleAnimation Duration="0:0:2" To="1.5" Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.TranslateY)" Storyboard.TargetName="_3" d:IsOptimized="True"/> <DoubleAnimation Duration="0:0:1" To="-1.5" Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.TranslateX)" Storyboard.TargetName="_2" d:IsOptimized="True"/> <DoubleAnimation Duration="0:0:1" To="-3" Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.TranslateY)" Storyboard.TargetName="_2" d:IsOptimized="True"/> <DoubleAnimation Duration="0" To="1.5" Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.TranslateX)" Storyboard.TargetName="_1" d:IsOptimized="True"/> </Storyboard> </VisualState> </VisualStateGroup> </VisualStateManager.VisualStateGroups> <Grid.ColumnDefinitions> <ColumnDefinition Width="0.298*"/> <ColumnDefinition Width="0.38*"/> <ColumnDefinition Width="0.322*"/> </Grid.ColumnDefinitions> <Grid x:Name="ImageGrid" Margin="8,19,8,192" Background="#FFFFDBDB" Grid.ColumnSpan="3"> <Image x:Name="_1" Margin="0,0,8,8" Source="/Fundo.jpg" RenderTransformOrigin="0.5,0.5"> <Image.RenderTransform> <CompositeTransform/> </Image.RenderTransform> </Image> <Image x:Name="_2" Source="AfriGIT 1.png" RenderTransformOrigin="0.5,0.5"> <Image.RenderTransform> <CompositeTransform/> </Image.RenderTransform> </Image> <Image x:Name="_3" Source="Diagrama AfriGIT 1.png" RenderTransformOrigin="0.5,0.5"> <Image.RenderTransform> <CompositeTransform/> </Image.RenderTransform> </Image> </Grid> <Grid x:Name="ControlGrid" Height="34" Margin="13,0,-67,192" VerticalAlignment="Bottom" Background="#FFC1FFF8" RenderTransformOrigin="0.633,0.324"> <Button x:Name="btn1" Content="" HorizontalAlignment="Left" VerticalAlignment="Top" Width="75" Margin="0,8,0,0"/> <Button x:Name="btn2" Content="" HorizontalAlignment="Left" VerticalAlignment="Top" Width="75" Margin="79,8,0,0"/> <Button x:Name="btn3" Content="" VerticalAlignment="Top" Margin="158,8,0,0" HorizontalAlignment="Left" Width="83"/> </Grid> </Grid> </UserControl> é isto que eu deveria copiar? 😄
petvetbr Posted May 1, 2012 at 11:28 PM Report #452573 Posted May 1, 2012 at 11:28 PM Sim era isto mesmo que eu precisava ver, porém pelo o que estou vendo os VisualStates não estão mudando as imagens. Algo não está funcionando na hora de criar os states. Fernando Lage Bastos - MCP/MCTS/MCPD
D3POD Posted May 2, 2012 at 07:55 AM Author Report #452602 Posted May 2, 2012 at 07:55 AM E onde poderei estar a falhar? Eu criei os states mas como me explicas te eu selecciono o state e arrasto a imagem para o ecrã, certo? O problema está mesmo da minha parte que não sei definir os states.
petvetbr Posted May 2, 2012 at 02:08 PM Report #452709 Posted May 2, 2012 at 02:08 PM Somente arrastar e soltar as imagens pode não funcionar nos states. O ideal é você selecionar o state, ir no lugar onde está a imagem e mudar a propriedade "source" dela diretamente, apontando para o local onde está a imagem que você deseja usar. Se você não ver uma linha onde propriedade "source" do controle esteja sendo mudado em cada state no seu XAML, não vai funcionar quando você rodar o programa. Mesmo com todos os recursos do Blend, a verdade é que ocasionalmente temos que recorrer a editar o XAML manualmente, aliás conforme vai se trabalhando profissionalmente com WPF/Silverlight/WindowsPhone, isto é mais verdade ainda, então é importante aprender a utilizar estes comandos diretamente também, caso o seu interesse seja ser um profissional da área. 😁 Fernando Lage Bastos - MCP/MCTS/MCPD
D3POD Posted May 2, 2012 at 08:36 PM Author Report #452810 Posted May 2, 2012 at 08:36 PM Sinceramente pareço um burro a olhar para um palácio 🙂 Já vi que o gajo não muda o source, mas ainda não percebi como colocar a funcionar bem 👍 Deve estar mesmo à frente dos olhos xD
petvetbr Posted May 2, 2012 at 08:50 PM Report #452813 Posted May 2, 2012 at 08:50 PM eu peguei um exemplo de um código que vi na internet para te dar uma idéia de como fazer na mão: <VisualState x:Name="MouseOver"> <Image Source="/Lds.CM.UI.Ag.Shared;component/Images/iconAdd.png" Width="25" /> </VisualState> <VisualState x:Name="Pressed"> <Image Source="/Lds.CM.UI.Ag.Shared;component/Images/iconAdd.png" Width="25" /> </VisualState> Fernando Lage Bastos - MCP/MCTS/MCPD
D3POD Posted May 2, 2012 at 09:24 PM Author Report #452820 Posted May 2, 2012 at 09:24 PM Então quando eu crio um state novo ele deveria ser introduzido no código...então o problema deve estar aí pois não aparece nada...
petvetbr Posted May 2, 2012 at 09:27 PM Report #452822 Posted May 2, 2012 at 09:27 PM Então, mas no XAML que vc colocou acima, os states estão sendo criados sim, veja este trecho: <VisualStateGroup x:Name="Teste"> <VisualStateGroup.Transitions> <VisualTransition GeneratedDuration="0:0:0.6"/> </VisualStateGroup.Transitions> <VisualState x:Name="a"/> <VisualState x:Name="b"> <Storyboard> <DoubleAnimation Duration="0:0:1" To="-3" Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.TranslateX)" Storyboard.TargetName="_2" d:IsOptimized="True"/> <DoubleAnimation Duration="0:0:1" To="1.5" Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.TranslateY)" Storyboard.TargetName="_2" d:IsOptimized="True"/> </Storyboard> </VisualState> <VisualState x:Name="c"> <Storyboard> <DoubleAnimation Duration="0:0:2" To="3" Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.TranslateX)" Storyboard.TargetName="_3" d:IsOptimized="True"/> <DoubleAnimation Duration="0:0:2" To="1.5" Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.TranslateY)" Storyboard.TargetName="_3" d:IsOptimized="True"/> <DoubleAnimation Duration="0:0:1" To="-1.5" Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.TranslateX)" Storyboard.TargetName="_2" d:IsOptimized="True"/> <DoubleAnimation Duration="0:0:1" To="-3" Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.TranslateY)" Storyboard.TargetName="_2" d:IsOptimized="True"/> <DoubleAnimation Duration="0" To="1.5" Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.TranslateX)" Storyboard.TargetName="_1" d:IsOptimized="True"/> </Storyboard> </VisualState> </VisualStateGroup> Fernando Lage Bastos - MCP/MCTS/MCPD
D3POD Posted May 2, 2012 at 09:37 PM Author Report #452823 Posted May 2, 2012 at 09:37 PM Sim já vi que está, mas não sei como adicionar lá a foto... já tentei adicionar um comando source mas não é por ai...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now