Silverlight 4 and browser

Does anyone know whether it is possible to animate app.current.mainwindow.width so that you get a nice animation with attenuation if you programmatically resize the oob apps window. Thanks.

+4
source share
2 answers

The easiest way is to add a slider to your page. The slider can be minimized and is used only for the convenience of animation. Animate the Value property of the slider. In the ValueChanged event of the slider, the width of the window is updated. For this you need increased traction.

It looks something like this:

Xaml

<UserControl.Resources> <Storyboard x:Name="Storyboard1"> <DoubleAnimation Duration="0:0:1" To="750" Storyboard.TargetProperty="(RangeBase.Value)" Storyboard.TargetName="slider1"> <DoubleAnimation.EasingFunction> <BounceEase EasingMode="EaseOut"/> </DoubleAnimation.EasingFunction> </DoubleAnimation> </Storyboard> </UserControl.Resources> <Grid x:Name="LayoutRoot" Background="Green"> <Button Width="50" Height="32" Click="Button_Click">Test</Button> <Slider Visibility="Collapsed" VerticalAlignment="Bottom" x:Name="slider1" Maximum="1000" ValueChanged="slider1_ValueChanged" /> </Grid> 

Code for

 private void Button_Click(object sender, RoutedEventArgs e) { Storyboard1.Begin(); } private void slider1_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e) { Application.Current.MainWindow.Width = e.NewValue; } 
+1
source

You should check out this Channel 9 presentation to configure the chrome window to support outside the browser. Your application requires increased trust in setting up chrome, but this may allow you to do what you want to do.

+1
source

Source: https://habr.com/ru/post/1305275/


All Articles