Note that there are some explanatory texts on larger screens.

plurals
  1. POWPF RenderTransform scale questions
    primarykey
    data
    text
    <p>I am trying to find answer to my problem without success. didn't found anyone trying to do something similar.</p> <p>I am simply trying to have a default scale factor on a DataGrid (object doesn't matter) and have it manually editable. Now let me explain in more detail.</p> <p>I have a Slider with value range from 10 to 100 with Interval ticks of 10.</p> <pre><code>&lt;Slider Name="sldZoom" IsSnapToTickEnabled="True" Height="180" Orientation="Vertical" TickPlacement="Both" Minimum="10" Maximum="100" Ticks="10, 20, 30, 40, 50, 60, 70, 80, 90, 100" Value="10" HorizontalAlignment="Center" /&gt; </code></pre> <p>Then i have a ScrollViewer with fix Height and Width for format purpose</p> <pre><code>&lt;ScrollViewer Name="scrZoomPanel" HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto" Height="500 Width="750" Background="White"&gt; </code></pre> <p>And at last I have in the scrollviewer a DataGrid with random columns and row quantity</p> <pre><code>&lt;DataGrid Name="grdArrangement" HorizontalAlignment="Stretch" HorizontalContentAlignment="Stretch" VerticalAlignment="Top" ItemsSource="{Binding Path=ListData}" IsHitTestVisible="False" CanUserAddRows="False" CanUserDeleteRows="False" CanUserReorderColumns="False" CanUserSortColumns="False" HeadersVisibility="None" AutoGenerateColumns="True" GridLinesVisibility="None" SelectionMode="Single" AutoGeneratingColumn="grdArrangement_AutoGeneratingColumn" AutoGeneratedColumns="grdArrangement_AutoGeneratedColumns" Background="White" &gt; &lt;DataGrid.RenderTransform&gt; &lt;ScaleTransform ScaleX="{Binding ElementName=sldZoom, Path=Value, Converter={StaticResource ZoomRatio}}" ScaleY="{Binding ElementName=sldZoom, Path=Value, Converter={StaticResource ZoomRatio}}" /&gt; &lt;/DataGrid.RenderTransform&gt; &lt;/DataGrid&gt; </code></pre> <p>the 2 auto generate event is because the grid get different cell styles assigned to it eveytime datasource changes</p> <p>So datagrid can get different amount of rows and columns and at Zoom Value 100 the scale is 1. At Zoom value of 10 scale is 0.1.</p> <p>In some case the grid get's bigger than the scrollviewer and it shows scrollbar and that's fine but what i want is : after the binding is complete and onpaint completed (everything generated), I want to zoom to the level that allow me to see everything. If not possible because the datagrid is too big i need to stop at Zoom 10 (10%). I need the zoom factor to stop ONLY on ticks that is inside the list.</p> <p>I tried iterating over the slide ticks and set the zoom and check if the scrollviewer still display scrollbars but that doesn't work the scrollviewer always show value before everything change. By that i mean if the grid was 1x1 pixel the scroll viewer scroll ba visible was false even if it zommed in enought for the 1x1 grid to be 1000 % zoom so 1000x1000 pixel and scrollbar actually shows. onve code finish running i click a button that message box scrollbar visibility and i see them as true.</p> <p>Seems like changing the slider value doesn't update the scale transform of the grid right away.</p> <p>So in short i simply want a Scale To Fit and that happen only once every binding update of the datagrid. I also know exactly everytime the grid datasource changes.</p> <p>thank you</p> <p>Edited Datagrid. Code showed LayoutTransform and not RenderTransform. I copied while i was testing LayoutTransform instead just to see if that was it. Anyhow both work on Zoom but zoom to fit fails</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload