locked
WorkflowDesigner.Load causes Grid resizing mouse cursor to stop working. RRS feed

  • Question

  • Hi all,

    We have a problem where WorklowDesigner.Load() causes the WPF Grid control's resizing mouse cursor not to come up. I have demo app written if anyone wants to double check. http://cid-467e12cdf12776bc.office.live.com/self.aspx/.Public/WpfApplication6.zip

     

    If you just run the demo, you will see the resize cursor will work when you hover over the red grid splitters. However if you go into the wfusercontrol2 control and uncomment this line //wf.Load(new System.Activities.Statements.Flowchart()); , then run the application again you will notice the resize cursor does not show up when hovering over the  grid splitter.

     

    It seems as though under the hood somewhere this exception occurs: Could not load file or assembly 'System.Activities.Presentation.Aero, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.


    Reading through the forumns I came up with this from Matt W. 

    "Right, what I meant is that you can't stop this exception from being thrown, it's part of the load process for the wf designer (at some point, even though you aren't showing a UI, it goes and tries to make sure it shouldn't render with a specific Aero theme (this is the WPF part I mentioned)). It gets handled higher up in the infrastructure stack, and it should never surface to your code. you can either just continue debugging, or there might be a debugging setting that will let you ignore them if they are thrown in system assemblies. " 

    Source: http://social.msdn.microsoft.com/Forums/en-US/wfprerelease/thread/d9ca4e05-7247-4923-a5f9-74d4edde2c1e

     

     

     

     

    My questions are, did I just find a whoopsie? and more importantly how can I grid my resize cursor up and going again?

     

    Thanks,

    Greg R

    • Edited by Greg Randall NZ Monday, October 11, 2010 9:55 PM Crappy subject.
    Monday, October 11, 2010 9:54 PM

Answers

  • This is indeed a bug in workflow designer where it would set the cursor to a fixed Arrow instead of the default cursor when there is a focus change. Unfortunately there isn't any work around available for this problem since focus change could happen often, we're very sorry about that.

     

    The workflow designer team is aware of this problem and will get it fixed in the next released of Visual Studio.

     

    Thanks,

    SGuy

    A quick and dirty fix might be to add handlers for the WorkflowDesigner.View (and WorkflowDesigner.PropertyInspectorView) GotFocus/LostFocus and MouseEnter/MouseLeave events and in those handlers set Mouse.OverrideCursor = null. This seems to remedy the problem for me.
    Friday, October 29, 2010 1:13 PM
  • This is indeed a bug in workflow designer where it would set the cursor to a fixed Arrow instead of the default cursor when there is a focus change. Unfortunately there isn't any work around available for this problem since focus change could happen often, we're very sorry about that.

     

    The workflow designer team is aware of this problem and will get it fixed in the next released of Visual Studio.

     

    Thanks,

    SGuy

    Tuesday, October 12, 2010 10:44 AM

All replies

  • created a sample for you and running on my machine.

    I can't find anywhere to upload.

    so paste the code here

    App.xaml

    <Application x:Class="WpfApplication1.App"
                 xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                 StartupUri="MainWindow.xaml">
        <Application.Resources>
            
        </Application.Resources>
    </Application>

     

    App.xaml.cs

    using System;
    using System.Collections.Generic;
    using System.Configuration;
    using System.Data;
    using System.Linq;
    using System.Windows;

    namespace WpfApplication1
    {
        /// <summary>
        /// Interaction logic for App.xaml
        /// </summary>
        public partial class App : Application
        {
        }
    }

    Mainwindow.xaml

    <Window x:Class="WpfApplication1.MainWindow"
            xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
            xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
            Title="MainWindow" Height="350" Width="525" xmlns:my="clr-namespace:WpfApplication1">
        <Grid>
            <my:UserControl1 HorizontalAlignment="Left" Margin="-18,129,0,0" x:Name="userControl11" VerticalAlignment="Top" Width="242" />
        </Grid>
    </Window>

    Mainwindow.xaml.cs

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Windows;
    using System.Windows.Controls;
    using System.Windows.Data;
    using System.Windows.Documents;
    using System.Windows.Input;
    using System.Windows.Media;
    using System.Windows.Media.Imaging;
    using System.Windows.Navigation;
    using System.Windows.Shapes;

    namespace WpfApplication1
    {
        /// <summary>
        /// Interaction logic for MainWindow.xaml
        /// </summary>
        public partial class MainWindow : Window
        {
            public MainWindow()
            {
                InitializeComponent();
            }
        }
    }

    usercontrol.xaml.cs

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Windows;
    using System.Windows.Controls;
    using System.Windows.Data;
    using System.Windows.Documents;
    using System.Windows.Input;
    using System.Windows.Media;
    using System.Windows.Media.Imaging;
    using System.Windows.Navigation;
    using System.Windows.Shapes;
    using System.Activities.Presentation;
    using System.Activities.Statements;
    using System.Activities.Core.Presentation;

    namespace WpfApplication1
    {
        /// <summary>
        /// Interaction logic for UserControl1.xaml
        /// </summary>
        public partial class UserControl1 : UserControl
        {
            public UserControl1()
            {
                InitializeComponent();
                new DesignerMetadata().Register();
                WorkflowDesigner designer = new WorkflowDesigner();
                designer.Load(new Flowchart());
                grid1.Children.Add(designer.View);
            }
        }
    }

    usercontrol.xaml

    <UserControl x:Class="WpfApplication1.UserControl1"
                 xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                 xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
                 xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
                 mc:Ignorable="d"
                 d:DesignHeight="300" d:DesignWidth="300">
        <Grid Name="grid1" >
               
        </Grid>
    </UserControl>

    .csproj file

    <?xml version="1.0" encoding="utf-8"?>
    <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
      <PropertyGroup>
        <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
        <Platform Condition=" '$(Platform)' == '' ">x86</Platform>
        <ProductVersion>8.0.30703</ProductVersion>
        <SchemaVersion>2.0</SchemaVersion>
        <ProjectGuid>{9675EDDC-4173-457A-9C21-7B1353C71D02}</ProjectGuid>
        <OutputType>WinExe</OutputType>
        <AppDesignerFolder>Properties</AppDesignerFolder>
        <RootNamespace>WpfApplication1</RootNamespace>
        <AssemblyName>WpfApplication1</AssemblyName>
        <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
        <TargetFrameworkProfile>Client</TargetFrameworkProfile>
        <FileAlignment>512</FileAlignment>
        <ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
        <WarningLevel>4</WarningLevel>
      </PropertyGroup>
      <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
        <PlatformTarget>x86</PlatformTarget>
        <DebugSymbols>true</DebugSymbols>
        <DebugType>full</DebugType>
        <Optimize>false</Optimize>
        <OutputPath>bin\Debug\</OutputPath>
        <DefineConstants>DEBUG;TRACE</DefineConstants>
        <ErrorReport>prompt</ErrorReport>
        <WarningLevel>4</WarningLevel>
      </PropertyGroup>
      <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
        <PlatformTarget>x86</PlatformTarget>
        <DebugType>pdbonly</DebugType>
        <Optimize>true</Optimize>
        <OutputPath>bin\Release\</OutputPath>
        <DefineConstants>TRACE</DefineConstants>
        <ErrorReport>prompt</ErrorReport>
        <WarningLevel>4</WarningLevel>
      </PropertyGroup>
      <ItemGroup>
        <Reference Include="System" />
        <Reference Include="System.Activities" />
        <Reference Include="System.Activities.Core.Presentation" />
        <Reference Include="System.Activities.Presentation" />
        <Reference Include="System.Data" />
        <Reference Include="System.Xml" />
        <Reference Include="Microsoft.CSharp" />
        <Reference Include="System.Core" />
        <Reference Include="System.Xml.Linq" />
        <Reference Include="System.Data.DataSetExtensions" />
        <Reference Include="System.Xaml">
          <RequiredTargetFramework>4.0</RequiredTargetFramework>
        </Reference>
        <Reference Include="WindowsBase" />
        <Reference Include="PresentationCore" />
        <Reference Include="PresentationFramework" />
      </ItemGroup>
      <ItemGroup>
        <ApplicationDefinition Include="App.xaml">
          <Generator>MSBuild:Compile</Generator>
          <SubType>Designer</SubType>
        </ApplicationDefinition>
        <Compile Include="UserControl1.xaml.cs">
          <DependentUpon>UserControl1.xaml</DependentUpon>
        </Compile>
        <Page Include="MainWindow.xaml">
          <Generator>MSBuild:Compile</Generator>
          <SubType>Designer</SubType>
        </Page>
        <Compile Include="App.xaml.cs">
          <DependentUpon>App.xaml</DependentUpon>
          <SubType>Code</SubType>
        </Compile>
        <Compile Include="MainWindow.xaml.cs">
          <DependentUpon>MainWindow.xaml</DependentUpon>
          <SubType>Code</SubType>
        </Compile>
        <Page Include="UserControl1.xaml">
          <SubType>Designer</SubType>
          <Generator>MSBuild:Compile</Generator>
        </Page>
      </ItemGroup>
      <ItemGroup>
        <Compile Include="Properties\AssemblyInfo.cs">
          <SubType>Code</SubType>
        </Compile>
        <Compile Include="Properties\Resources.Designer.cs">
          <AutoGen>True</AutoGen>
          <DesignTime>True</DesignTime>
          <DependentUpon>Resources.resx</DependentUpon>
        </Compile>
        <Compile Include="Properties\Settings.Designer.cs">
          <AutoGen>True</AutoGen>
          <DependentUpon>Settings.settings</DependentUpon>
          <DesignTimeSharedInput>True</DesignTimeSharedInput>
        </Compile>
        <EmbeddedResource Include="Properties\Resources.resx">
          <Generator>ResXFileCodeGenerator</Generator>
          <LastGenOutput>Resources.Designer.cs</LastGenOutput>
        </EmbeddedResource>
        <None Include="Properties\Settings.settings">
          <Generator>SettingsSingleFileGenerator</Generator>
          <LastGenOutput>Settings.Designer.cs</LastGenOutput>
        </None>
        <AppDesigner Include="Properties\" />
      </ItemGroup>
      <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
      <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
           Other similar extension points exist, see Microsoft.Common.targets.
      <Target Name="BeforeBuild">
      </Target>
      <Target Name="AfterBuild">
      </Target>
      -->
    </Project>

    Tuesday, October 12, 2010 5:12 AM
  • the step is create wpf app

    and add wpf user control

    then paste my user control code

    Tuesday, October 12, 2010 5:14 AM
  • This is indeed a bug in workflow designer where it would set the cursor to a fixed Arrow instead of the default cursor when there is a focus change. Unfortunately there isn't any work around available for this problem since focus change could happen often, we're very sorry about that.

     

    The workflow designer team is aware of this problem and will get it fixed in the next released of Visual Studio.

     

    Thanks,

    SGuy

    Tuesday, October 12, 2010 10:44 AM
  • This is indeed a bug in workflow designer where it would set the cursor to a fixed Arrow instead of the default cursor when there is a focus change. Unfortunately there isn't any work around available for this problem since focus change could happen often, we're very sorry about that.

     

    The workflow designer team is aware of this problem and will get it fixed in the next released of Visual Studio.

     

    Thanks,

    SGuy

    A quick and dirty fix might be to add handlers for the WorkflowDesigner.View (and WorkflowDesigner.PropertyInspectorView) GotFocus/LostFocus and MouseEnter/MouseLeave events and in those handlers set Mouse.OverrideCursor = null. This seems to remedy the problem for me.
    Friday, October 29, 2010 1:13 PM
  • Thanks Frits, 

    This worked for me.


    Greg
    Monday, November 8, 2010 10:18 PM