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...
and the view model...
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
Here's quick sample of code to demonstrate the problem...
<
Window
xmlns:TestAppWpf
=
"clr-namespace:TestApp_WPF"
xmlns:telerik
=
"http://schemas.telerik.com/2008/xaml/presentation"
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