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

BusyIndicator Disables Hyperlinks in DataGrid

1 Answer 64 Views
BusyIndicator
This is a migrated thread and some comments may be shown as answers.
Scott
Top achievements
Rank 1
Scott asked on 16 Sep 2013, 04:30 PM
Hi, I've encountered an issue when a DataGrid is placed inside a RadBusyIndicator (most current build of WPF Controls), a hyperlink in a column in the grid will be disabled.

Here's quick sample of code to demonstrate the problem...
<Window
    xmlns:TestAppWpf="clr-namespace:TestApp_WPF"
    x:Class="TestApp_WPF.MainWindowView"
    x:Name="window"
    Width="800" Height="600"
    TextOptions.TextFormattingMode="Display"
    AllowDrop="True">
 
    <Window.Resources>
        <TestAppWpf:MainWindowViewModel x:Key="Vm" />
    </Window.Resources>
 
    <telerik:RadBusyIndicator DataContext="{Binding Source={StaticResource Vm}}"
                              IsBusy="{Binding IsBusy, Mode=OneWay}"
                              BusyContent="{Binding BusyContent, Mode=OneWay}">
        <StackPanel Margin="6" DataContext="{Binding Source={StaticResource Vm}}">
            <TextBlock Margin="3">
                <Hyperlink>
                    <i:Interaction.Triggers>
                        <i:EventTrigger EventName="Click">
                            <ei:CallMethodAction TargetObject="{Binding}" MethodName="DoWork" />
                        </i:EventTrigger>
                    </i:Interaction.Triggers>
                    <TextBlock Text="Click Me" />
                </Hyperlink>
            </TextBlock>
 
            <DataGrid Margin="3"
                      ItemsSource="{Binding Items}"
                      SelectedItem="{Binding SelectedItem}"
                      AutoGenerateColumns="False"
                      SelectionUnit="FullRow"
                      SelectionMode="Single"
                      CanUserDeleteRows="False"
                      CanUserAddRows="False"
                      IsReadOnly="True"
                      AllowDrop="True">
 
                <DataGrid.Columns>
                    <DataGridTextColumn Binding="{Binding FirstName}" />
                    <DataGridTextColumn Binding="{Binding LastName}" />
                    <DataGridTextColumn Binding="{Binding DOB}" />
 
                    <DataGridTemplateColumn x:Name="uxColumn_Edit"
                                            CanUserSort="False">
                        <DataGridTemplateColumn.CellTemplate>
                            <DataTemplate>
                                <TextBlock Margin="3">
                                    <Hyperlink>
                                        <i:Interaction.Triggers>
                                            <i:EventTrigger EventName="Click">
                                                <ei:CallMethodAction
                                                    TargetObject="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=DataGrid}, Path=DataContext}"
                                                    MethodName="DoWork" />
                                            </i:EventTrigger>
                                        </i:Interaction.Triggers>
                                        <TextBlock Text="Edit" />
                                    </Hyperlink>
                                </TextBlock>
                            </DataTemplate>
                        </DataGridTemplateColumn.CellTemplate>
                    </DataGridTemplateColumn>
                </DataGrid.Columns>
            </DataGrid>
        </StackPanel>
    </telerik:RadBusyIndicator>
</Window>

and the view model...
using System;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Threading;
using System.Threading.Tasks;
 
namespace TestApp_WPF
{
    public class MainWindowViewModel : INotifyPropertyChanged
    {
        #region Fields
 
        private bool _isBusy;
        private string _busyContent;
        public event PropertyChangedEventHandler PropertyChanged;
        protected virtual void OnProperyChanged(string propertyName)
        {
            if (PropertyChanged != null)
                PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
        }
 
        public ObservableCollection<Person> _items;
        public Person _selectedItem;
 
        #endregion
 
        #region Properties
 
        /// <summary>
        ///     Gets or sets a value indicating whether [is busy].
        /// </summary>
        /// <value>
        ///     <c>true</c> if [is busy]; otherwise, <c>false</c>.
        /// </value>
        public bool IsBusy
        {
            get { return _isBusy; }
            set
            {
                if (_isBusy == value)
                    return;
 
                _isBusy = value;
                OnProperyChanged("IsBusy");
            }
        }
 
        /// <summary>
        ///     Gets or sets the content of the busy.
        /// </summary>
        /// <value>
        ///     The content of the busy.
        /// </value>
        public string BusyContent
        {
            get { return _busyContent; }
            set
            {
                if (_busyContent == value)
                    return;
 
                _busyContent = value;
                OnProperyChanged("BusyContent");
            }
        }
 
        /// <summary>
        /// Gets the items.
        /// </summary>
        /// <value>
        /// The items.
        /// </value>
        public ObservableCollection<Person> Items
        {
            get
            {
                if (_items == null)
                {
                    _items = new ObservableCollection<Person>
                    {
                        new Person
                        {
                            FirstName = "John",
                            LastName = "Doe",
                            DOB = new DateTime(1972, 5, 9),
 
                        },
                        new Person
                        {
                            FirstName = "Jim",
                            LastName = "Smith",
                            DOB = new DateTime(1954, 12, 15),
 
                        }
                    };
                }
 
                return _items;
            }
        }
 
        /// <summary>
        /// Gets or sets the selected item.
        /// </summary>
        /// <value>
        /// The selected item.
        /// </value>
        public Person SelectedItem
        {
            get { return _selectedItem; }
            set
            {
                if (_selectedItem == value)
                    return;
 
                _selectedItem = value;
                OnProperyChanged("SelectedItem");
            }
        }
 
        #endregion
 
        #region Methods
 
        public void DoWork()
        {
            Task.Factory.StartNew(
                () =>
                {
                    IsBusy = true;
                    BusyContent = "Working...";
                    Thread.Sleep(5000);
                    IsBusy = false;
                });
        }
 
        #endregion
    }
 
    public class Person
    {
        public string FirstName { get; set; }
 
        public string LastName { get; set; }
 
        public DateTime DOB { get; set; }
    }
}

As you'll see, the hyperlinks in the datagrid's "edit" column are disabled.  However, if you comment out the RadBusyIndicator (and it's closing tag), the "edit" column will then be enabled.  Also, if it helps, if you change the datagrid to "IsReadOnly=False", then an edit hyperlink will become enabled if you double click on it.

As you can also see, the hyperlink at the top of the window that is not part of the datagrid is unaffected by this issue.

Thanks,
Andy

1 Answer, 1 is accepted

Sort by
0
Kalin
Telerik team
answered on 19 Sep 2013, 10:37 AM
Hello Andy,

Thanks for the provided sample code, we successfully reproduced the described issue. It looks like there is some problem between BusyIndicator and the hyperlinks in DataGrid. However we suggest you to use RadGridView instead of DataGrid. For your convenience we have created and attached here a sample project using GridView instead of DataGrid.

Hope this helps.

Regards,
Kalin
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
Tags
BusyIndicator
Asked by
Scott
Top achievements
Rank 1
Answers by
Kalin
Telerik team
Share this question
or