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

DataForm inside BusyIndicator appears disabled after BusyIndicator stops being busy

9 Answers 139 Views
BusyIndicator
This is a migrated thread and some comments may be shown as answers.
Richard
Top achievements
Rank 1
Richard asked on 14 Dec 2010, 02:21 AM
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

9 Answers, 1 is accepted

Sort by
0
Teodor
Telerik team
answered on 14 Dec 2010, 10:41 AM
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
0
Richard
Top achievements
Rank 1
answered on 14 Dec 2010, 09:32 PM
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
0
Teodor
Telerik team
answered on 20 Dec 2010, 12:37 PM
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
0
Richard
Top achievements
Rank 1
answered on 20 Dec 2010, 06:24 PM
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

0
Accepted
Teodor
Telerik team
answered on 22 Dec 2010, 04:01 PM
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
0
Richard
Top achievements
Rank 1
answered on 24 Dec 2010, 07:47 AM
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
0
Todd
Top achievements
Rank 1
answered on 30 Dec 2010, 05:02 PM
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>
0
Teodor
Telerik team
answered on 03 Jan 2011, 02:23 PM
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
0
stacy cook
Top achievements
Rank 1
answered on 13 Dec 2011, 05:45 PM

Tags
BusyIndicator
Asked by
Richard
Top achievements
Rank 1
Answers by
Teodor
Telerik team
Richard
Top achievements
Rank 1
Todd
Top achievements
Rank 1
stacy cook
Top achievements
Rank 1
Share this question
or