This is a migrated thread and some comments may be shown as answers.

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

10 Answers 105 Views
ScheduleView
This is a migrated thread and some comments may be shown as answers.
Durga
Top achievements
Rank 1
Durga asked on 30 Dec 2016, 01:06 PM

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?

10 Answers, 1 is accepted

Sort by
0
Ivan Ivanov
Telerik team
answered on 02 Jan 2017, 12:28 PM
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.
0
Durga
Top achievements
Rank 1
answered on 04 Jan 2017, 09:45 AM
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?
0
Tanya
Telerik team
answered on 06 Jan 2017, 11:07 AM
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 you to write beautiful native mobile apps using a single shared C# codebase.
0
Tanya
Telerik team
answered on 06 Jan 2017, 11:17 AM
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 you to write beautiful native mobile apps using a single shared C# codebase.
0
Durga
Top achievements
Rank 1
answered on 31 Jan 2017, 03:40 PM

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.

 

 

 

0
Durga
Top achievements
Rank 1
answered on 01 Feb 2017, 01:40 PM

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.

0
Kalin
Telerik team
answered on 03 Feb 2017, 11:16 AM
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.
0
Durga
Top achievements
Rank 1
answered on 01 Mar 2017, 12:46 PM

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

0
Kalin
Telerik team
answered on 06 Mar 2017, 08:50 AM
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.
0
Durga
Top achievements
Rank 1
answered on 16 Mar 2017, 10:00 AM

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

Tags
ScheduleView
Asked by
Durga
Top achievements
Rank 1
Answers by
Ivan Ivanov
Telerik team
Durga
Top achievements
Rank 1
Tanya
Telerik team
Kalin
Telerik team
Share this question
or