DataForm inside BusyIndicator appears disabled after BusyIndicator stops being busy

10 posts, 1 answers
  1. Richard
    Richard avatar
    30 posts
    Member since:
    Oct 2010

    Posted 13 Dec 2010 Link to this post

    Hi,


    We've run into an issue that only seems to happen when the following are true:

    * There's a DataForm inside a BusyIndicator
    * The BusyIndicator initially has IsBusy=True
    * IsBusy becomes false afterwards (e.g. when the viewmodel property it's bound to changes.)

    When IsBusy becomes false, the "Loading..." animation disappears, but the DataForm remains grayed out. If I click on a TextBox or other control inside the DataForm, the grayed-out effect goes away, and the DataForm appears normal.

    I tried the "restore the focus" technique, but it didn't work - this seems to be a separate issue.

    We're using the Q3 2010 release.


    Here's a sample to illustrate the problem:

    <UserControl x:Class="IMS.UI.Views.MP.Test"
        xmlns:tk="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data.DataForm.Toolkit"
        xmlns:System="clr-namespace:System;assembly=mscorlib"
        mc:Ignorable="d"
        d:DesignHeight="300" d:DesignWidth="400">
         
        <UserControl.Resources>
            <!-- dummy resource just so the dataform has something to bind to -->
            <System:String x:Key="Foo" /> 
        </UserControl.Resources>
         
        <Grid x:Name="LayoutRoot" Background="White">
            <Grid.RowDefinitions>
                <RowDefinition Height="*" />
                <RowDefinition Height="Auto" />
            </Grid.RowDefinitions>
             
            <telerik:RadBusyIndicator x:Name="busyIndicator" Grid.Row="0" IsBusy="True">
                <tk:DataForm x:Name="dfForm" CurrentItem="{StaticResource Foo}">
                    <tk:DataForm.EditTemplate>
                        <DataTemplate>
                            <StackPanel Height="100">
                                <TextBlock>Blah</TextBlock>
                                <TextBox Text="this is some text" />
                            </StackPanel>
                        </DataTemplate>
                    </tk:DataForm.EditTemplate>
                </tk:DataForm>
            </telerik:RadBusyIndicator>
             
            <CheckBox Grid.Row="1" Content="Busy" IsChecked="{Binding ElementName=busyIndicator, Path=IsBusy, Mode=TwoWay}" />
        </Grid>
    </UserControl>


    I've also attached screenshots showing (1) the busy indicator correctly appearing busy, (2) the unexpected disabled effect, and (3) the correct appearance of the DataForm after I click inside the text box.


    Thanks for your help,
    Richard

  2. Teodor
    Admin
    Teodor avatar
    501 posts

    Posted 14 Dec 2010 Link to this post

    Hi Richard,

    Thank you for contacting us.

    We have recently fixed an issue related to your scenario, so feel free to try running your project with the assemblies from the Latest Internal Build (2010.3.1213).

    Hope it works in your case. Let us know in case you have further issues.

    All the best,
    Teodor
    the Telerik team
    Browse the videos here>> to help you get started with RadControls for Silverlight
  3. DevCraft banner
  4. Richard
    Richard avatar
    30 posts
    Member since:
    Oct 2010

    Posted 14 Dec 2010 Link to this post

    Hi Teodor,

    Thanks for your help.

    I tried the latest build though, and unfortunately the issue is still happening for me. I'm using build 2010.3.1213.1040.

    Thanks,
    Richard
  5. Teodor
    Admin
    Teodor avatar
    501 posts

    Posted 20 Dec 2010 Link to this post

    Hello Richard,

    Thank you for your reply and sorry for our late response.

    Could you please send us your project (or a running extract of it), so that we can reproduce locally the issue you are running into?

    Thank you in advance.

    Greetings,
    Teodor
    the Telerik team
    Browse the videos here>> to help you get started with RadControls for Silverlight
  6. Richard
    Richard avatar
    30 posts
    Member since:
    Oct 2010

    Posted 20 Dec 2010 Link to this post

    Hi Teodor,

    No problem and thanks for your help.

    I've submitted support ticket 377954, with an attached sample project that reproduces this issue.

    Thanks,
    Richard

  7. Answer
    Teodor
    Admin
    Teodor avatar
    501 posts

    Posted 22 Dec 2010 Link to this post

    Hello Richard,

    Thank you for submitting the support ticket.

    After some research, the problem seemed to be in the DataForm, not properly updating its IsEnabled state in some particular scenarios.

    Please refer to the reply in the support ticket and let us know in case you need further assistance.

    Greetings,
    Teodor
    the Telerik team
    Browse the videos here>> to help you get started with RadControls for Silverlight
  8. Richard
    Richard avatar
    30 posts
    Member since:
    Oct 2010

    Posted 24 Dec 2010 Link to this post

    Thanks Teodor - I just replied and closed the support ticket.

    You're right, it's a bug in how the DataForm responds when the enabled state of its surrounding control changes. Your sample code using a ContentControl shows it's not caused by the Telerik BusyIndicator.

    I did some searching and found this open issue describing the same DataForm bug:
    http://silverlight.codeplex.com/workitem/4729?PendingVoteId=4729

    Stefan Olson documented a workaround here, which involves subclassing the DataForm to add an IsEnabledChanged handler:
    http://www.olsonsoft.com/blogs/stefanolson/post/Workarounds-for-dataform-bugs.aspx

    Thanks again,
    Richard
  9. Todd
    Todd avatar
    3 posts
    Member since:
    Jul 2010

    Posted 30 Dec 2010 Link to this post

    From the previous linked Olson blog,

    The best way to fix this is to add a custom behavior to your DataForm. When your mouse enters the DataForm = fixed (I experienced the best results with MouseEnter, if you guys can think of a better way inside the behavior, post it here for sure).

    You first create a class:

    using System;
    using System.Net;
    using System.Windows;
    using System.Windows.Controls;
    using System.Windows.Documents;
    using System.Windows.Ink;
    using System.Windows.Input;
    using System.Windows.Media;
    using System.Windows.Media.Animation;
    using System.Windows.Shapes;
    using System.Windows.Interactivity;
     
    namespace VDSM.Classes
    {
        public class DataFormBehavior : Behavior<DependencyObject>
        {
            //I added this Behavior because there is a bug within the DataForm control, if used within a RadBusyIndicator - the DataForm will appear Disabled even though its not.. - Todd
            private const string DATAFORM_stateDisabled = "Disabled";
            private const string DATAFORM_stateNormal = "Normal";
     
            public DataFormBehavior()
            {
     
            }
     
            protected override void OnAttached()
            {
                base.OnAttached();
                var ad = this.AssociatedObject as FrameworkElement;
     
                ad.MouseEnter  += (sender, args) =>
                {
                    VisualStateManager.GoToState((DataForm)this.AssociatedObject, DATAFORM_stateNormal, true);
                }; 
            }
     
            protected override void OnDetaching()
            {
                base.OnDetaching();
            }
        }
    }


    Then back in your xaml where your DataForm is hosted:

    xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
    xmlns:behavior="clr-namespace:VDSM.Classes"
     
     
     
    <df:DataForm x:Name="myDataForm">
     
                        <i:Interaction.Behaviors>
                            <behavior:DataFormBehavior />
                        </i:Interaction.Behaviors>
  10. Teodor
    Admin
    Teodor avatar
    501 posts

    Posted 03 Jan 2011 Link to this post

    Hello guys,

    Thank you for your involvement, we will contact you in case we come up with a different/better workaround.

    Do not hesitate to contact us in case you need further support.

    Regards,

    Teodor
    the Telerik team
    Browse the videos here>> to help you get started with RadControls for Silverlight
  11. stacy cook
    stacy cook avatar
    1 posts
    Member since:
    Dec 2009

    Posted 13 Dec 2011 Link to this post


Back to Top
DevCraft banner