

When performing a ShowDialog (and even .Show) of WPF Window within the MouseDoubleClick event of the RadTreeView, mouse events (MouseEnter, Click, etc..) no longer fire in the Dialogue Window. It gives the appearance of hanging, but keyboard nav functions just fine.
Interestingly, by moving focus to a different window and alt-tabbing back to the dialogue, the mouse events are once again detected.
I have only noticed this in the MouseDoubleClick event.
The workaround that I am using to avoid this problem is to set a flag in the MouseDoubleClick event and then check the flag in the MouseLeftButtonUp event. If I fire the .Show or .ShowDialog from the MouseLeftButtonUp event, all is OK and the problem does not appear.
Details
VS 2010 Ultimate
Telerik - WPF 2011 Q2 - SP1
Win 7 - 64
Reproduce
Create WPF Application with two windows (MainWindow and TestDLG)
Build/Run
Double Click on Item 1
Hit Cancel Button
If it doesn't appear to lock on first try, repeat. Always get it to lock before doing this three or four times.
When it locks, just Alt-Tab out and then back to the test application and the mouse lives again.
This sample is as simple as I could make.
<Window x:Class="MainWindow" Title="MainWindow" Height="280" Width="400" xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"> <Grid> <telerik:RadTreeView Height="128" HorizontalAlignment="Left" Margin="160,72,0,0" Name="RadTreeView1" VerticalAlignment="Top" BorderThickness="1" BorderBrush="Black" Width="125"> <telerik:RadTreeViewItem DropPosition="Inside" Header="Item 1" /> </telerik:RadTreeView> </Grid></Window>MainWindow - Code Behind
Class MainWindow Private Sub RadTreeView1_MouseDoubleClick(sender As Object, e As System.Windows.Input.MouseButtonEventArgs) Handles RadTreeView1.MouseDoubleClick Dim tw As New TestDLG tw.ShowDialog() tw.Close() End SubEnd ClassMainWindow CodeBehind (Workaround)
This is the workaround that allows the ShowDialog to occur on doubleclick event but not lose mouse events.
Class MainWindow Private _DidDoubleClick As Boolean Private Sub RadTreeView1_MouseDoubleClick(sender As Object, e As System.Windows.Input.MouseButtonEventArgs) Handles RadTreeView1.MouseDoubleClick _DidDoubleClick = True End Sub Private Sub RadTreeView1_MouseLeftButtonUp(sender As Object, e As System.Windows.Input.MouseButtonEventArgs) Handles RadTreeView1.MouseLeftButtonUp If _DidDoubleClick Then _DidDoubleClick = False Dim tw As New TestDLG tw.ShowDialog() tw.Close() End If End SubEnd ClassDialog Window
<Window x:Class="TestDLG" Title="TestDLG" Height="300" Width="300"> <Grid> <Button Content="Button" Height="29" HorizontalAlignment="Left" Margin="82,204,0,0" Name="Button1" VerticalAlignment="Top" Width="97" /> </Grid></Window>
Dialog Window CodeBehind
Public Class TestDLG Private Sub Button1_Click(sender As System.Object, e As System.Windows.RoutedEventArgs) Handles Button1.Click Me.Hide() End SubEnd Class<rad:SeriesMapping.SeriesDefinition> <rad:BarSeriesDefinition ShowItemLabels="True" ShowItemToolTips="True" ItemLabelFormat="#ProposedSalesQty{#,###,###,##0}" ItemToolTipFormat="#AttributeName, #ProposedSalesQty{#,###,###,##0}" Visibility="{Binding ProposedSalesQtySeriesVisibility}"> <rad:BarSeriesDefinition.Appearance> <rad:SeriesAppearanceSettings Fill="SkyBlue" /> </rad:BarSeriesDefinition.Appearance> </rad:BarSeriesDefinition> </rad:SeriesMapping.SeriesDefinition>((LineSeriesDefinition)MixChart.SeriesMappings[0].SeriesDefinition).SetBinding( LineSeriesDefinition.VisibilityProperty, new Binding("ProposedSalesQtySeriesVisibility"));<
telerik:RadGridView x:Name="RadGridView1" ItemsSource="{Binding Path=Table, Mode=TwoWay,
UpdateSourceTrigger=PropertyChanged}" GridLinesVisibility="Both" IsReadOnly="True"
CanUserFreezeColumns="False" RowIndicatorVisibility="Collapsed" CanUserReorderColumns="False"
ShowGroupPanel="False" HorizontalAlignment="Left" SelectionMode="Extended" SelectionUnit="Cell"
BorderThickness="0">
<
telerik:RadGridView.FilterDescriptors>
<telerik:FilterDescriptor Member="ParentID" Operator="IsEqualTo" Value="0"/>
</telerik:RadGridView.FilterDescriptors>
<
telerik:RadGridView.ChildTableDefinitions>
<telerik:GridViewTableDefinition>
<telerik:GridViewTableDefinition.Relation>
<telerik:TableRelation IsSelfReference="True">
<telerik:TableRelation.FieldNames>
<telerik:FieldDescriptorNamePair ParentFieldDescriptorName="ServiceID" ChildFieldDescriptorName="ParentID"/>
</telerik:TableRelation.FieldNames>
</telerik:TableRelation>
</telerik:GridViewTableDefinition.Relation>
</telerik:GridViewTableDefinition>
</telerik:RadGridView.ChildTableDefinitions>
</telerik:RadGridView>
In the ViewModel,
private
DataTable _table;
public DataTable Table
{
get { return _table; }
set
{
_table = value;
RaisePropertyChanged(() => this.Table);
}
}
[
ImportingConstructor]
public MatrixViewModel(IEventAggregator eventAggregator)
{
this.TabModel = new TabModel { Title = "Matrix" };
if (eventAggregator != null)
eventAggregator.GetEvent<MatrixReloadEvent>().Subscribe(OnContractCreatedOrLoaded);
}
private void OnContractCreatedOrLoaded(ContractCreatedOrLoadedEventArgs args)
{
DataTable dtOutput = new DataTable();
..buliding the datatable and assigning to the Table property
}
From the other screen I am calling the event "OnContractCreatedOrLoaded" while adding new items. For the first time (add 1 or n number of items) and view the grid screen. It works perfectly (Grid will have only one row - ParentID = 0).
Now add 1 new item ("OnContractCreatedOrLoaded" event will be fired) and see the grid, it binds all the rows in the datatable without filtering or hierarchy (grid is having all the rows instead of showing ParentID = 0)
Any help appreciated.
Thanks,
Ramasamy