silverlight 4.0 scrollviewer not updating - silverlight-4.0

I am new to Silverlight. I am trying to provide a zoom in functionality along with inkpresenter. I am using Silverlight 4, c#, asp.net. I can bind the slider to canvas and it does zoom in but i am facing problem with the scrollviewer layout which is not updating. there are allot of post that mentioned that i need to used layout transform. Can any one please let me know what i am doing wrong or any other suggestion.
<Slider x:Name="slider" Maximum="2" Minimum="0" Value="1" Width="100"/>
</StackPanel>
<ScrollViewer x:Name="scrollBar" VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto" Grid.Column="1" Margin="6,1,1,1" Grid.Row="1">
<ScrollViewer.Content>
<toolkit:LayoutTransformer Name="TheTransformer" Background="{x:Null}">
<toolkit:LayoutTransformer.LayoutTransform>
<ScaleTransform x:Name="contentScale" ScaleX="{Binding ElementName=slider,Path=Value}" ScaleY="{Binding ElementName=slider,Path=Value}" />
</toolkit:LayoutTransformer.LayoutTransform>
<toolkit:LayoutTransformer.Content>
<Canvas x:Name="cnsImageEditable" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" OpacityMask="#FFE89E9E">
<!--The following commented bit does work i can zoomin and out but scroller not updating -->
<!--<Canvas.RenderTransform>
<ScaleTransform x:Name="scale" ScaleX="{Binding ElementName=slider,Path=Value}" ScaleY="{Binding ElementName=slider,Path=Value}"/>
</Canvas.RenderTransform>-->
<InkPresenter x:Name="inkCanvas" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
<Image x:Name="imgEditableImage" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"></Image>
</InkPresenter>
</Canvas>
</toolkit:LayoutTransformer.Content>
</toolkit:LayoutTransformer>
</ScrollViewer.Content>
</ScrollViewer>
any help is much appretiated thanks

Check out https://stackoverflow.com/questions/9899729/layouttransformer-in-silverlight-not-working , worked for me. Specifically:
I found that Transforms in silverlight happens after Layout, so I changed the CanvasWidth property only once till the scrollbars show, and then zooming would work perfectly,

Related

Is there a way to remove or customize Pivot transitions?

By default, Pivots transition their PivotItems in/out using a horizontal translation with an opacity fade. I'd like a way to remove them (firstly), but also customize if possible.
Things I've tried to remove them (just passing an empty TransititionCollection in):
<Pivot>
<Pivot.Transitions>
<TransitionCollection />
</Pivot.Transitions>
<Pivot.ItemContainerTransitions>
<TransitionCollection />
</Pivot.ItemContainerTransitions>
<PivotItem Header="Red">
<PivotItem.Transitions>
<TransitionCollection />
</PivotItem.Transitions>
<PivotItem.ContentTransitions>
<TransitionCollection />
</PivotItem.ContentTransitions>
<Grid Background="Red" Width="100" Height="200" />
</PivotItem>
<PivotItem Header="Green">
<Grid Background="Green" Width="100" Height="200" />
</PivotItem>
</Pivot>
If you dig into the default Pivot template, you will find the following part for the content:
<ItemsPresenter x:Name="PivotItemPresenter" Grid.ColumnSpan="3" Grid.Row="1">
<ItemsPresenter.RenderTransform>
<TransformGroup>
<TranslateTransform x:Name="ItemsPresenterTranslateTransform"/>
<CompositeTransform x:Name="ItemsPresenterCompositeTransform"/>
</TransformGroup>
</ItemsPresenter.RenderTransform>
</ItemsPresenter>
These two Transforms inside the TransformGroup manage the animation of the items, there is no Transition behind it. This means that setting TransitionCollection empty has unfortunately no effect.
Even more unfortunate is the fact that you cannot easily remove the transition, because trying trying to remove either of the two Transforms from the Pivot style will make the control not render properly. This is likely because both transforms are referenced within the controls code-behind.
As a result, it seems that customizing the animation of the built-in Pivot is unfortunately not possible.

Windows 8 Store App Sliding Panel

I am working on a Windows 8 Store App. I want to use sliding panel for my application such as facebook mobile application leftside menu or rightside friends list. What am i want to do ? When i click to button panel should open left 0 to right side about 300px but i didn't find any solution for this. Can you help me for this ? Thx inadvance.
I SOLVED
Actually, I don't want to work with scrollview i want to show a setting pane. I solved my problem with using settingflyout. So, you can use basicly in your project. Add new item >> add settingflyout. But thx for your answer.
<ScrollViewer
x:Name="HorizontalScrollViewer"
VerticalScrollBarVisibility="Auto"
VerticalScrollMode="Disabled"
ZoomMode="Disabled"
HorizontalScrollBarVisibility="Auto"
HorizontalScrollMode="Auto"
HorizontalSnapPointsAlignment="Near"
HorizontalSnapPointsType="Mandatory">
<StackPanel
Orientation="Horizontal">
<Grid
x:Name="LeftPanel">
...
</Grid>
<Grid
x:Name="CenterPanel">
<ListView .../>
</Grid>
<Grid
x:Name="RightPanel">
...
</Grid>
</StackPanel>
</ScrollViewer>

ScrollViewer Issue with StackPanel in Windows Phone 8

I put StackPanel into ScrollViewr, When scrolling to last item it returns back to its old position.
<ScrollViewer Margin="0,0,0,20">
<StackPanel>
//Textblocks and Textboxes ...
</StackPanel>
</ScrollViewer>
After search i found that:
ItemsControl, VirtualizingStackPanel and ScrollViewer height
I changed my code to:
<StackPanel>
//Textblocks and Textboxes ...
</StackPanel>
<ScrollViewer>
<VirtualizingStackPanel />
</ScrollViewer>
I can't set CanContentScroll="True" as i can't find it.
Also make exception:
System.InvalidOperationException: A VirtualizingPanel is not nested in an ItemsControl. VirtualizingPanel must be nested in ItemsControl to get and show items.
What must i do, to enable scrolling without returning back to its old position?
Regards,
After search again ...
I found this Post which solve the problem of Scrolling return to old position when open keyboard.
Scrolling page with keyboard shown
code after updates:
<ScrollViewer Height="500" VerticalAlignment="Top">
<StackPanel Height="700">
//Textblocks and Textboxes ...
</StackPanel>
</ScrollViewer>

Windows phone 8 viewport control

I try to understand how windows phone viewport control Bounds work.
So i can give
viewport.Bunds = new Rect(x,y,width, height);
but what that bound stand for is it a scrollable area in the viewport.
Can anyone give me a working simple example of it cause whenever i try to use this parameter i can't scroll in viewport whatsover
<Grid x:Name="ContentPanel" Grid.Row="1" Margin="0,0,0,0">
<ViewportControl Name="tuzik" Bounds="0,0,300,400" Margin="66,117,20,41" >
<Canvas Name="canvas">
<Image Name="TestImage" Source="Assets\testimage.jpg"
HorizontalAlignment="Left" VerticalAlignment="Top"
Canvas.Left="-379" Canvas.Top="-769" Stretch="Fill" />
</Canvas>
</ViewportControl>
<Rectangle x:Name="rect" Width="300" Height="400" Margin="60,111,63,0" Stroke="Aqua" />
</Grid>
I believe your problem is the Canvas within the ViewportControl. Canvas does not expand to fill the ViewportControl and will not expand to contain the contents, either. You have to set a Width and Height on the Canvas.
(At least, that's how I have mine setup.)

Windows8 ListView LineHeight

I have added a ListView to a Metro Style Blank App. Added to the ListView are 3 Strings. I want to change the LineHeight , but cannot find a property. Below is my xaml code.
<Grid Background="{StaticResource ApplicationPageBackgroundBrush}">
<ListView HorizontalAlignment="Left" Height="277.167" Margin="235.51,161,0,0" VerticalAlignment="Top" Width="100" RenderTransformOrigin="0.5,0.5" UseLayoutRounding="False" d:LayoutRounding="Auto">
<ListView.RenderTransform>
<CompositeTransform SkewX="-0.338" TranslateX="-0.327"/>
</ListView.RenderTransform>
<x:String>test 1</x:String>
<x:String>Test2</x:String>
<x:String>Test3</x:String>
</ListView>
</Grid>
How do I decrease, increase the line height of the strings in the ListView box? I want to decrease the space between the lines.
Thanks
Try editing a ItemContainerTemplate and then play with the properties available like margin and padding.
See my answer here :
WPF ComboBox customization in windows8
let me know in case you need any help.