90 degree rotation causes exception

13 posts, 0 answers
  1. Ryan
    Ryan avatar
    12 posts
    Member since:
    Apr 2012

    Posted 13 Jun 2012 Link to this post

    I'm trying to use the RadLayoutTransformControl to do a 90 degree layout rotation of a control that is part of the ItemTemplate of a RadDataBoundListBox. This results in an exception being thrown with the message "0x8000ffff". The callstack is as follows:

       at MS.Internal.XcpImports.CheckHResult(UInt32 hr)
       at MS.Internal.XcpImports.WriteableBitmap_CalculateSize(WriteableBitmap wb, UIElement element, Transform transform)
       at System.Windows.Media.Imaging.WriteableBitmap..ctor(UIElement element, Transform transform)
       at Telerik.Windows.Controls.RadLayoutTransformControl.g(Transform A_0)
       at Telerik.Windows.Controls.RadLayoutTransformControl.OnContentChanged(Object oldContent, Object newContent)
       at System.Windows.Controls.ContentControl.OnContentChanged(IntPtr nativeTarget, CValue& oldContentValue, CValue& newContentValue)
       at MS.Internal.XcpImports.SetValueNative(IntPtr element, UInt32 property, CValue& outval)
       at MS.Internal.XcpImports.SetValue(IManagedPeerBase obj, DependencyProperty property, DependencyObject doh)
       at MS.Internal.XcpImports.SetValue(IManagedPeerBase doh, DependencyProperty property, Object obj)
       at System.Windows.DependencyObject.SetObjectValueToCore(DependencyProperty dp, Object value)
       at System.Windows.DependencyObject.SetEffectiveValue(DependencyProperty property, EffectiveValueEntry& newEntry, Object newValue)
       at System.Windows.DependencyObject.UpdateEffectiveValue(DependencyProperty property, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, ValueOperation operation)
       at System.Windows.DependencyObject.SetValueInternal(DependencyProperty dp, Object value, Boolean allowReadOnlySet)
       at System.Windows.DependencyObject.SetValueInternal(DependencyProperty dp, Object value)
       at System.Windows.DependencyObject.SetValue(DependencyProperty dp, Object value)
       at System.Windows.Controls.ContentControl.set_Content(Object value)
       at System.Reflection.RuntimeMethodInfo.InternalInvoke(RuntimeMethodInfo rtmi, Object obj, BindingFlags invokeAttr, Binder binder, Object parameters, CultureInfo culture, Boolean isBinderDefault, Assembly caller, Boolean verifyAccess, StackCrawlMark& stackMark)
       at System.Reflection.RuntimeMethodInfo.InternalInvoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, StackCrawlMark& stackMark)
       at System.Reflection.RuntimePropertyInfo.InternalSetValue(PropertyInfo thisProperty, Object obj, Object value, Object[] index, StackCrawlMark& stackMark)
       at System.Reflection.RuntimePropertyInfo.SetValue(Object obj, Object value, Object[] index)
       at MS.Internal.XamlMemberInfo.SetValue(Object target, Object value)
       at MS.Internal.XamlManagedRuntimeRPInvokes.SetValue(XamlTypeToken inType, XamlQualifiedObject& inObj, XamlPropertyToken inProperty, XamlQualifiedObject& inValue)
       at MS.Internal.XcpImports.MeasureOverrideNative(IntPtr element, Single inWidth, Single inHeight, Single& outWidth, Single& outHeight)
       at MS.Internal.XcpImports.FrameworkElement_MeasureOverride(FrameworkElement element, Size availableSize)
       at System.Windows.FrameworkElement.MeasureOverride(Size availableSize)
       at System.Windows.FrameworkElement.MeasureOverride(IntPtr nativeTarget, Double inWidth, Double inHeight, Double& outWidth, Double& outHeight)
       at MS.Internal.XcpImports.MeasureOverrideNative(IntPtr element, Single inWidth, Single inHeight, Single& outWidth, Single& outHeight)
       at MS.Internal.XcpImports.FrameworkElement_MeasureOverride(FrameworkElement element, Size availableSize)
       at System.Windows.FrameworkElement.MeasureOverride(Size availableSize)
       at System.Windows.FrameworkElement.MeasureOverride(IntPtr nativeTarget, Double inWidth, Double inHeight, Double& outWidth, Double& outHeight)
       at MS.Internal.XcpImports.MeasureNative(IntPtr element, Single inWidth, Single inHeight)
       at MS.Internal.XcpImports.UIElement_Measure(UIElement element, Size availableSize)
       at System.Windows.UIElement.Measure(Size availableSize)
       at Telerik.Windows.Controls.StackVirtualizationStrategy.MeasureContainer(RadVirtualizingDataControlItem container)
       at Telerik.Windows.Controls.VirtualizationStrategy.GetContainerForItem(IDataSourceItem item, Int32 insertAt)
       at Telerik.Windows.Controls.StackVirtualizationStrategy.GetContainerForItem(IDataSourceItem item, Int32 insertAt)
       at Telerik.Windows.Controls.VirtualizationStrategy.GetContainerForItem(IDataSourceItem item, Boolean insertLast)
       at Telerik.Windows.Controls.VirtualizationStrategy.ManageLowerViewport(Boolean recycle)
       at Telerik.Windows.Controls.RadVirtualizingDataControl.ManageViewport()
       at Telerik.Windows.Controls.RadVirtualizingDataControl.BalanceVisualSpace()
       at Telerik.Windows.Controls.RadVirtualizingDataControl.w()
       at Telerik.Windows.Controls.RadVirtualizingDataControl.x()
       at Telerik.Windows.Controls.RadVirtualizingDataControl.et(NotifyCollectionChangedEventArgs A_0)
       at Telerik.Windows.Controls.RadVirtualizingDataControl.OnItemsChanged(NotifyCollectionChangedEventArgs e)
       at Telerik.Windows.Controls.RadDataBoundListBox.OnItemsChanged(NotifyCollectionChangedEventArgs e)
       at Telerik.Windows.Controls.Primitives.DataControlBase.b(Object A_0, NotifyCollectionChangedEventArgs A_1)
       at Telerik.Windows.Data.RadListSource.OnCollectionChanged(NotifyCollectionChangedEventArgs e)
       at Telerik.Windows.Data.RadListSource.RefreshOverride()
       at Telerik.Windows.Data.RadListSource.Refresh()
       at Telerik.Windows.Data.RadListSource.AttachData(IEnumerable data)
       at Telerik.Windows.Data.RadListSource.SetSource(IEnumerable value)
       at Telerik.Windows.Data.RadListSource.set_SourceCollection(IEnumerable value)
       at Telerik.Windows.Controls.RadDataBoundListBox.OnItemsSourceChanged(IEnumerable oldSource)
       at Telerik.Windows.Controls.Primitives.DataControlBase.a2(DependencyObject A_0, DependencyPropertyChangedEventArgs A_1)
       at System.Windows.DependencyObject.RaisePropertyChangeNotifications(DependencyProperty dp, Object oldValue, Object newValue)
       at System.Windows.DependencyObject.UpdateEffectiveValue(DependencyProperty property, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, ValueOperation operation)
       at System.Windows.DependencyObject.RefreshExpression(DependencyProperty dp)
       at System.Windows.Data.BindingExpression.RefreshExpression()
       at System.Windows.Data.BindingExpression.SendDataToTarget()
       at System.Windows.Data.BindingExpression.SourcePropertyChanged(PropertyPathListener sender, PropertyPathChangedEventArgs args)
       at System.Windows.PropertyPathListener.RaisePropertyPathStepChanged(PropertyPathStep source)
       at System.Windows.PropertyAccessPathStep.RaisePropertyPathStepChanged(PropertyListener source)
       at System.Windows.CLRPropertyListener.SourcePropertyChanged(Object sender, PropertyChangedEventArgs args)
       at System.Windows.Data.WeakPropertyChangedListener.PropertyChangedCallback(Object sender, PropertyChangedEventArgs args)
  2. Victor
    Admin
    Victor avatar
    1351 posts

    Posted 14 Jun 2012 Link to this post

    Hi Ryan,

    Thank you for reporting this.
    I am afraid that I was not able to reproduce this exception.
    Is it possible to send the XAML or code that you use to initialize the layout transform control so that I may debug it?

    Greetings,
    Victor
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  3. DevCraft banner
  4. Vijay
    Vijay avatar
    29 posts
    Member since:
    Nov 2011

    Posted 15 Jun 2012 Link to this post

    Hello Ryan,

    Please provide the part of source code which mainly deals with implementation logic of Layout Transform. The issue is not reproducible for me. But please do send your scenario in which you observed

    In the mean while, Please find the below link for posting on Layout Transform. Hope this should be useful.

    Click Here for Layout Transform Sample Post

    Thanks and Regards,
    Vijay
    MVC Corp
  5. Ryan
    Ryan avatar
    12 posts
    Member since:
    Apr 2012

    Posted 19 Jun 2012 Link to this post

    Here is a chunk of xaml from my app with a bunch of stuff ripped out and lots of broken bindings of course, but if you paste it into the MainPage.xaml of a new project using the "Windows Phone Application" template in VS, it will repro the issue:

    <phone:PhoneApplicationPage 
        x:Class="PhoneApp5.MainPage"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
        xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        mc:Ignorable="d" d:DesignWidth="480" d:DesignHeight="768"
        xmlns:telerikInput="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.Input"
        xmlns:telerikPrimitives="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.Primitives"
        FontFamily="{StaticResource PhoneFontFamilyNormal}"
        FontSize="{StaticResource PhoneFontSizeNormal}"
        Foreground="{StaticResource PhoneForegroundBrush}"
        SupportedOrientations="Portrait" Orientation="Portrait"
        shell:SystemTray.IsVisible="True">


        <phone:PhoneApplicationPage.Resources>
            <Style x:Key="RadRatingStarStyle" TargetType="telerikInput:RadRating">
                <Setter Property="ItemShapeGeometry" Value="F1M850.8262,276.1572L857.8862,271.0282L849.2022,271.0282L846.4622,262.7272L843.7222,271.0282L835.0392,271.0282L842.0982,276.1572L839.4022,284.4562L846.4632,279.3272L853.5232,284.4562z" />
            </Style>
        </phone:PhoneApplicationPage.Resources>
        
        <!--LayoutRoot is the root grid where all page content is placed-->
        <Grid x:Name="LayoutRoot" Background="Transparent">
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="*"/>
            </Grid.RowDefinitions>


            <!--TitlePanel contains the name of the application and page title-->
            <StackPanel x:Name="TitlePanel" Grid.Row="0" Margin="12,17,0,28">
                <TextBlock x:Name="ApplicationTitle" Text="MY APPLICATION" Style="{StaticResource PhoneTextNormalStyle}"/>
                <TextBlock x:Name="PageTitle" Text="page name" Margin="9,-7,0,0" Style="{StaticResource PhoneTextTitle1Style}"/>
            </StackPanel>


            <!--ContentPanel - place additional content here-->
            <Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
                <telerikPrimitives:RadDataBoundListBox ItemsSource="{Binding Data}">
                    <telerikPrimitives:RadDataBoundListBox.ListFooterContent>
                        <Rectangle Height="72" />
                    </telerikPrimitives:RadDataBoundListBox.ListFooterContent>
                    <telerikPrimitives:RadDataBoundListBox.ItemTemplate>
                        <DataTemplate>
                            <Button Content="{Binding}">
                                <Button.Template>
                                    <ControlTemplate TargetType="Button">
                                        <telerikPrimitives:RadDockPanel Margin="0,0,0,12" LastChildFill="False">
                                            <TextBlock telerikPrimitives:RadDockPanel.Dock="Top" FontSize="{StaticResource PhoneFontSizeLarge}" FontFamily="Segoe WP Black">
                                                <Run Text="{Binding Route.Name}" />
                                            </TextBlock>
                                            <Border BorderThickness="2" BorderBrush="{StaticResource PhoneForegroundBrush}"
                                                    Width="120" Height="160" Margin="{StaticResource PhoneVerticalMargin}">
                                                <Border.Background>
                                                    <SolidColorBrush Color="{StaticResource PhoneForegroundColor}" Opacity="0.5" />
                                                </Border.Background>
                                                <Viewbox Stretch="Uniform">
                                                    <TextBlock Text="?" />
                                                </Viewbox>
                                            </Border>
                                            <Image Name="image" telerikPrimitives:RadDockPanel.Dock="Left" Source="Background.png" Stretch="None" Margin="{StaticResource PhoneVerticalMargin}" />
                                            <StackPanel telerikPrimitives:RadDockPanel.Dock="Left">
                                                <StackPanel telerikPrimitives:RadDockPanel.Dock="Top" Margin="12,0,0,0">
                                                    <TextBlock Text="{Binding Route.AverageGrade}" FontSize="64" />
                                                    <TextBlock Text="{Binding Route.GradeVoteCount, StringFormat='(\{0\} votes)'}" Style="{StaticResource PhoneTextSmallStyle}" Margin="0,-12,0,0" />
                                                </StackPanel>
                                                <StackPanel telerikPrimitives:RadDockPanel.Dock="Top" Margin="12,12,0,0">
                                                    <telerikInput:RadRating Style="{StaticResource RadRatingStarStyle}"
                                                    Value="{Binding Route.AverageRating}"
                                                    IsReadOnly="True" ItemShapeHeight="24" ItemShapeWidth="24" VerticalAlignment="Center" />
                                                    <TextBlock Text="{Binding Route.RatingVoteCount, StringFormat='(\{0\} votes)'}" Style="{StaticResource PhoneTextSmallStyle}" Margin="0" />
                                                </StackPanel>
                                            </StackPanel>
                                            <Border telerikPrimitives:RadDockPanel.Dock="Right" BorderThickness="1,0,0,0" BorderBrush="{StaticResource PhoneForegroundBrush}"
                                                    Margin="{StaticResource PhoneMargin}" Padding="{StaticResource PhoneHorizontalMargin}">
                                                <Grid>
                                                    <Grid.RowDefinitions>
                                                        <RowDefinition Height="Auto" />
                                                        <RowDefinition Height="*" />
                                                    </Grid.RowDefinitions>
                                                    <Grid.ColumnDefinitions>
                                                        <ColumnDefinition Width="Auto" />
                                                        <ColumnDefinition Width="Auto" />
                                                    </Grid.ColumnDefinitions>
                                                    <Image Grid.Row="0" Grid.Column="1" Source="/ApplicationIcon.png" Stretch="Uniform" HorizontalAlignment="Center" />
                                                    <telerikPrimitives:RadLayoutTransformControl Grid.Row="1" Grid.Column="1">
                                                        <telerikPrimitives:RadLayoutTransformControl.LayoutTransform>
                                                            <RotateTransform Angle="90" />
                                                        </telerikPrimitives:RadLayoutTransformControl.LayoutTransform>
                                                        <TextBlock Text="{Binding Route.RouteType}" FontSize="{StaticResource PhoneFontSizeSmall}" Margin="{StaticResource PhoneHorizontalMargin}" />
                                                    </telerikPrimitives:RadLayoutTransformControl>
                                                </Grid>
                                            </Border>
                                        </telerikPrimitives:RadDockPanel>
                                    </ControlTemplate>
                                </Button.Template>
                            </Button>
                        </DataTemplate>
                    </telerikPrimitives:RadDataBoundListBox.ItemTemplate>
                </telerikPrimitives:RadDataBoundListBox>
            </Grid>
        </Grid>


    </phone:PhoneApplicationPage>
  6. Victor
    Admin
    Victor avatar
    1351 posts

    Posted 21 Jun 2012 Link to this post

    Hi Ryan,

    Thanks for writing again. I finally managed to reproduce the issue and it has been fixed. The updated version will be available for download sometime next week.

    Kind regards,
    Victor
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  7. Ryan
    Ryan avatar
    12 posts
    Member since:
    Apr 2012

    Posted 11 Jul 2012 Link to this post

    I tried the updated version, and now it doesn't crash, but it also doesn't do the transformation correctly. While it does rotate it 90 degrees, it is also shifted down about 50 pixels and truncated on the bottom. You should be able to repro this with the example I supplied earlier in this thread (might require some tweaks to make sure the text is not empty due to a broken binding).
  8. Victor
    Admin
    Victor avatar
    1351 posts

    Posted 17 Jul 2012 Link to this post

    Hi Ryan,

    Thanks for reporting this. I reproduced the described issue. I will let you know what is causing it and what you can do to workaround it as soon as I get to the bottom of it. 

    Regards,
    Victor
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  9. Ryan
    Ryan avatar
    5 posts
    Member since:
    Oct 2011

    Posted 24 Aug 2012 Link to this post

    Any update on this?
  10. Victor
    Admin
    Victor avatar
    1351 posts

    Posted 24 Aug 2012 Link to this post

    Hello Ryan,

    It appears that there are limitations in the silverlight framework (quite possibly a bug) that causes this behavior.

    Please have a look at the attached app. RadLayoutTransform uses a WriteableBitmap internally to compute the dimensions of the bounding box of the transformed content and with certain UI elements the width and height of the resulting bitmap are bogus which causes the clipping. Also the writeable bitmap respects neither the render transform origin of the rendered element nor the center settings of the transform.

    Thanks for understanding.

    Regards,

    Victor
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  11. Rajen
    Rajen avatar
    4 posts
    Member since:
    Apr 2012

    Posted 24 Mar 2013 Link to this post

    Apologies for resurrecting an old thread, but it seems this issue still persists in the latest version of RadControl (also for Windows Phone 8). I'm trying to rotate a RadCartesianChart 90 degrees in a PivotItem section, but it seems the behavior is still unexpected (shifted and clipped). Any suggestions?
  12. Victor
    Admin
    Victor avatar
    1351 posts

    Posted 26 Mar 2013 Link to this post

    Hello Rajen,

    Can you please clarify how you are rotating the chart? A simple RotateTransform set as the RenderTransform of the chart should suffice.

    Greetings,
    Victor
    the Telerik team
    Have a suggestion or face a problem - you can use the Ideas & Feedback portal to submit ideas, feedback and vote for them.
  13. Rajen
    Rajen avatar
    4 posts
    Member since:
    Apr 2012

    Posted 26 Mar 2013 Link to this post

    Hi,

    I tried this, but it won't work for a few reasons:

    For one, this seems to shift the entire chart off the page in combination with the pivot. https://5fxkiw.bn1.livefilestore.com/y1pyGyHshkBQ2Xcz8FcjZSnwFHe2CHkDM2eM2eMHmVEk3wKWpHc20FI_31cL-2amVZJSF9zMLt1O1Fm4vVHep0HE6WXW95YrUHN/chart_pivot.png?psid=1

    Even if it didn't (I made this screenshot while swiping to the other PivotItem), the reason I wanted to use a LayoutTransform is that it would autofit into the available space of the PivotItem. As you can see in this screenshot, it leaves a bunch of blank space at the bottom when using a RenderTransform: https://5fxkiw.bn1.livefilestore.com/y1p1DrBVafOvRjoCJEb5kq_-IUso2552Zcw1nXFQThFZQSdMvPZXN711g8Nv-0OARjfNMlIQjJ7pUYe9Au0_EUKLzOpYEjnxX6n/chart_shift.png?psid=1
  14. Victor
    Admin
    Victor avatar
    1351 posts

    Posted 27 Mar 2013 Link to this post

    Hello Rajen,

    When using a simple RotateTransform, are you setting the RenderTransformOrigin of the chart to 0.5, 0.5? If you do not, the chart will be rotated around the top left corner?

    I am afraid that the layout transform control does not work the way you expect it to. It transforms its content taking into account its desired size, calculates the bounding box of the result and sets its own Width and Height to the dimensions of this bounding box. Since it uses the desired size of the content it will never stretch itself to fill a parent container.

    Can you please clarify why you need to rotate the chart in such a manner? Is it a part of your app design?

    Regards,
    Victor
    the Telerik team
    Have a suggestion or face a problem - you can use the Ideas & Feedback portal to submit ideas, feedback and vote for them.
Back to Top
DevCraft banner