"Width Must be Non-Negative" when "F2" function key is pressed

11 posts, 0 answers
  1. Durga
    Durga avatar
    6 posts
    Member since:
    Jul 2016

    Posted 30 Dec 2016 Link to this post

    Hi,

    I have Radcontrols for WPF Q1 2011 installed and I am using ScheduleView control in my application. I implemented Function key bindings (other than F2 key) on WPF window. On running the application, all Function keys work as expected but when I press F2 key followed by any other Function key, it gives me the error "Width Must be Non-Negative". The error popup is cascaded to infinite loop which as the application to crash.

    I also found this is the issue with control and it has been fixed in Radcontrols for WPF Q2 2013. My application is not compatible with latest version, got lots of build errors. Please reply how can I make my application compatible with latest version? And how can I download the Radcontrols for WPF Q2 2013 version?

  2. Ivan Ivanov
    Admin
    Ivan Ivanov avatar
    1191 posts

    Posted 02 Jan Link to this post

    Hi,

    To ease the migration path to newer versions, we provide support resources for changes and backwards compatibility for all controls. Here are the articles for RadScheduleView: "Changes", "Backwards Compatibility". If you encounter build errors related to the other controls, you can find identical articles in the corresponding subsections.
    Generally, we recommend the latest official service pack release as the most appropriate stable upgrade version. Looking through your account details, I noticed that the current license was activated during 2016, so that Q2 2013 is not an active option. Can you please confirm whether you want to migrate to the latest version, or to Q2 2013, which we will enable for you if it is needed?

    Regards,
    Ivan Ivanov
    Telerik by Progress
    Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
  3. Durga
    Durga avatar
    6 posts
    Member since:
    Jul 2016

    Posted 04 Jan in reply to Ivan Ivanov Link to this post

    Thanks for your reply. I want to migrate to the latest version. I have one custom DragDropBehavior class that inherits DefaultDragDropBehavior class. What is the equivalent class for DefaultDragDropBehavior  in latest version? Also is there any converter tool available for WPF that can help to convert controls in my application to their equivalent controls in latest version?
  4. Tanya
    Admin
    Tanya avatar
    531 posts

    Posted 06 Jan Link to this post

    Hi Durga,

    The class has been renamed and you can use it with its new name - ScheduleViewDragDropBehavior

    For upgrading the version of Telerik controls you are using, you can take advantage of the Project Upgrade Wizard. This tool will download the new version of the suite and replace the references in the specified projects. In its latest version, there is also included integration with the Upgrade API Analyzer tool through the Compatibility button. The analyzer checks the code you are using and notifies you if there are any changes that affect your project.

    I hope this information is helpful.

    Regards,
    Tanya
    Telerik by Progress
    Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
  5. Tanya
    Admin
    Tanya avatar
    531 posts

    Posted 06 Jan Link to this post

    Hi Durga,

    Just wanted to let you know that we are expecting our latest release to be available for download in a couple of weeks. If you would like, you can wait to upgrade directly to the new version.

    All the new features and bug fixes included in each version you can find in the release notes.

    Regards,
    Tanya
    Telerik by Progress
    Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
  6. Durga
    Durga avatar
    6 posts
    Member since:
    Jul 2016

    Posted 31 Jan in reply to Tanya Link to this post

    Thanks for your reply.

    Now I downloaded the latest release (Q1 2017) and used 'Upgrade API Analyser' to check the application compatibility with the latest version, its not showing me any issue.

    And after upgrading solution, I got the same build errors as before.

    1. Type 'DefaultDragDropBehavior' is not defined.

    2. Function 'GetDragDropStateForExternalDrag' cannot be declared 'Overrides' because it does not override a function in a base class.

    3. Sub 'Drop' cannot be declared 'Overrides' because it does not override a sub in a base class.

    4. The tag 'OrientedGroupHeaderContentTemplateSelector' does not exist in XML namespace 'http://schemas.telerik.com/2008/xaml/presentation'.

    Could you please provide more information on how can I fix these issues?

    Thanks.

     

     

     

  7. Durga
    Durga avatar
    6 posts
    Member since:
    Jul 2016

    Posted 01 Feb in reply to Durga Link to this post

    Hi,

    I just want to update you on same.

    I was able to fix first three errors and for the forth one I replaced 'OrientedGroupHeaderContentTemplateSelector' with 'GroupHeaderTemplateSelector' (as mentioned in another post).

    After that I got errors for all inner templates. For example, The attachable property 'HorizontalDayViewDateTemplate' was not found in type 'GroupHeaderTemplateSelector'. Following is the affected code.

    <telerik:OrientedGroupHeaderContentTemplateSelector x:Key="GroupHeaderContentTemplateSelector">
            <telerik:OrientedGroupHeaderContentTemplateSelector.HorizontalDayViewDateTemplate>
                <DataTemplate>
                    <TextBlock FontFamily="Arial" FontSize="20" FontWeight="Bold"  VerticalAlignment="Top" HorizontalAlignment="Center"  
                               Margin="1,1" Text="{Binding Name, StringFormat= ddd}"/>
                </DataTemplate>
            </telerik:OrientedGroupHeaderContentTemplateSelector.HorizontalDayViewDateTemplate>
            <telerik:OrientedGroupHeaderContentTemplateSelector.HorizontalWeekViewDateTemplate>
                <DataTemplate>
                    <Border >
                        <TextBlock FontFamily="Arial"   FontWeight="Bold" FontSize="16" HorizontalAlignment="Center"  
                                   Margin="1,1" Text="{Binding Name, StringFormat= ddd}"/>
                    </Border>
                </DataTemplate>
            </telerik:OrientedGroupHeaderContentTemplateSelector.HorizontalWeekViewDateTemplate>
            <telerik:OrientedGroupHeaderContentTemplateSelector.HorizontalResourceTemplate>
                <DataTemplate>
                    <Border Background="{Binding Name.Brush}" Height="30" Margin="0,0,0,0"  BorderThickness="0,0,0,0">
                        <StackPanel Margin="0,0,0,0" Orientation="Horizontal">
                            <StackPanel Orientation="Vertical">
                                <TextBlock VerticalAlignment="center"  HorizontalAlignment="Center"    
                                           Foreground="Black" FontSize="12" FontWeight="Bold" Text="{Binding Name.DisplayName}" />
                            </StackPanel>
                        </StackPanel>
                    </Border>
                </DataTemplate>
            </telerik:OrientedGroupHeaderContentTemplateSelector.HorizontalResourceTemplate>
            <telerik:OrientedGroupHeaderContentTemplateSelector.VerticalWeekViewDateTemplate>
                <DataTemplate>
                    <TextBlock Width ="120" FontFamily="Arial"  FontSize="19" FontWeight="Bold" Background="Transparent"  
                                   Margin="1,1" Text="{Binding Name, StringFormat=ddd,Converter={StaticResource UCaseConverter} }"  
                                   VerticalAlignment="Top"   HorizontalAlignment="Center" >
                        <TextBlock.LayoutTransform>
                            <RotateTransform Angle="90"/>
                        </TextBlock.LayoutTransform>
                    </TextBlock >
                </DataTemplate>
            </telerik:OrientedGroupHeaderContentTemplateSelector.VerticalWeekViewDateTemplate>
            <telerik:OrientedGroupHeaderContentTemplateSelector.VerticalDayViewDateTemplate>
                <DataTemplate>
                    <TextBlock FontFamily="Arial" FontSize="15" FontWeight="Bold" 
                                   Margin="1,1" Text="{Binding Name, StringFormat=ddd}" VerticalAlignment="Top">
                        <TextBlock.LayoutTransform>
                            <RotateTransform Angle="90"/>
                        </TextBlock.LayoutTransform>
                    </TextBlock>
                </DataTemplate>
            </telerik:OrientedGroupHeaderContentTemplateSelector.VerticalDayViewDateTemplate>
            <telerik:OrientedGroupHeaderContentTemplateSelector.VerticalResourceTemplate>
                <DataTemplate>
                    <Border Background="{Binding Name.Brush}" Width="30" Margin="-2,-2,-2,-2" Padding="0,2,0,0">
                        <StackPanel Margin="-2,-2,-2,-2">
                            <TextBlock  VerticalAlignment="Center" HorizontalAlignment="Center"  
                                            Foreground="black" Margin="-2,-2,-2,-2" FontSize="14" 
                                            FontWeight="Bold" Text="{Binding Name.DisplayName}" />
                        </StackPanel>
                    </Border>
                </DataTemplate>
            </telerik:OrientedGroupHeaderContentTemplateSelector.VerticalResourceTemplate>
        </telerik:OrientedGroupHeaderContentTemplateSelector>

    Please guide me, how can I modify the code with respect to the latest version?

    Thanks.

  8. Kalin
    Admin
    Kalin avatar
    1262 posts

    Posted 03 Feb Link to this post

    Hello Durga,

    Regarding the results of Upgrade API Analyser - it currently work only for C# code and I assume your project is in VB? So that is why it didn't show any of the errors.

    As for the ScheduleView questions:

    Indeed you should use GroupHeaderTemplateSelector, which now has only two properties - HorizontalTemplate and VerticalTemplate. You can check below the default definition of the selector in Office_Black theme:

    <telerik:GroupHeaderTemplateSelector x:Key="GroupHeaderContentTemplateSelector">
        <telerik:GroupHeaderTemplateSelector.HorizontalTemplate>
            <DataTemplate>
                <ContentPresenter Content="{Binding FormattedName}" Height="16" Margin="4"/>
            </DataTemplate>
        </telerik:GroupHeaderTemplateSelector.HorizontalTemplate>
        <telerik:GroupHeaderTemplateSelector.VerticalTemplate>
            <DataTemplate>
                <ContentPresenter Content="{Binding FormattedName}" Margin="4" Height="16" VerticalAlignment="Top">
                    <ContentPresenter.LayoutTransform>
                        <RotateTransform Angle="-90"/>
                    </ContentPresenter.LayoutTransform>
                </ContentPresenter>
            </DataTemplate>
        </telerik:GroupHeaderTemplateSelector.VerticalTemplate>
    </telerik:GroupHeaderTemplateSelector>

    However you could always implement a custom one as explained in the following article:
    http://docs.telerik.com/devtools/wpf/controls/radscheduleview/styles-and-templates/templating-groupheaders#how-to-create-a-custom-groupheadercontenttemplateselector

    DefaultDragDropBehavior class is replaced with ScheduleViewDragDropBehavior. You should inherit from it and override the needed methods. For more details please check this article from our help documentation. If you have any particular issues and difficulties with the exact implementation please share them and will be glad to help you in order to achieve the same behavior.

    If you have any further questions or concerns, please let us know.

    Regards,
    Kalin
    Telerik by Progress
    Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
  9. Durga
    Durga avatar
    6 posts
    Member since:
    Jul 2016

    Posted 01 Mar Link to this post

    Hi,

    As you suggested, I implemented a custom class for GroupHeaderTemplateSelector 'MyGroupHeaderTemplateSelector' and referred in the ResourceDictionary (both files in the same project).

    When I build the application, I got one error: The name "MyGroupHeaderTemplateSelector" does not exist in the namespace "clr-namespace:MyApp.CustomGroupHeaderTemplateSelector". To fix this, I created one separate class library for custom class, added that project reference in my application and accordingly changed the namespace name in ResourceDictionary. Please suggest, if there any simple approach to fix it.

    After that, I added one tag (using custom class) in ResourceDictionary as below.

    <vm:MyGroupHeaderTemplateSelector x:Key="GroupHeaderTemplateSelector1">
            <vm:MyGroupHeaderTemplateSelector.HorizontalDayViewDateTemplate>
                <DataTemplate>
                    <TextBlock FontFamily="Arial" FontSize="20" FontWeight="Bold"  VerticalAlignment="Top" HorizontalAlignment="Center"  
                               Margin="1,1" Text="{Binding Name, StringFormat= ddd}"/>
                </DataTemplate>
            </vm:MyGroupHeaderTemplateSelector.HorizontalDayViewDateTemplate>

            <!-- Other View Templates -->

    </vm:MyGroupHeaderTemplateSelector>

    Now, on compiling the application, I am getting errors for all the properties (templates declared in custom class).

    e.g. The attached property 'HorizontalDayViewDateTemplate' was not found in type 'MyGroupHeaderTemplateSelector'.

    I went through few links and found, need to declare custom class properties as Attached Properties. Please suggest, is it the correct solution? Please share link/demo where it's explained in detail.

    Thanks,

    Durga

  10. Kalin
    Admin
    Kalin avatar
    1262 posts

    Posted 06 Mar Link to this post

    Hi Durga,

    If you don't need any additional templates you could simply use the default GroupHeaderTemplateSelector class. If you need to use more templates and implement custom logic selecting them - you would need to inherit from the GroupHeaderTemplateSelector, define the additional templates and override the SelectTemplate method as explained in the article from my previous reply.

    Hope this helps. However if you still experience issues, I would like to ask you to open up a support ticket and provide sample project demonstrating them, so we can check it on our side and provide you with the correct solution.

    Regards,
    Kalin
    Telerik by Progress
    Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
  11. Durga
    Durga avatar
    6 posts
    Member since:
    Jul 2016

    Posted 16 Mar Link to this post

    To fix the attached property error, Telerik team suggested to declare data templates as 'Property' in custom class.

    And it worked for me. Thanks for the support.

    Namespace CustomGroupHeaderTemplateSelector
        Public Class MyGroupHeaderTemplateSelector
            Inherits ScheduleViewDataTemplateSelector

            Public Property HorizontalDayViewDateTemplate As DataTemplate
            Public Property HorizontalWeekViewDateTemplate As DataTemplate
            Public Property HorizontalResourceTemplate As DataTemplate
            Public Property VerticalDayViewDateTemplate As DataTemplate
            Public Property VerticalWeekViewDateTemplate As DataTemplate
            Public Property VerticalResourceTemplate As DataTemplate

            <!-- Override SelectTemplate method here  -->

    End Class
    End Namespace

Back to Top