none
Listbox-Drop Error in Word-Addin with Office2010 SP1 RRS feed

  • Question

  • Hi Folks,

    I wrote a Word-2007-Addin in VS 2010 with Office 2007 on the developing machine. The machine had Office 2010 installed before.
    The addin needs to be deployed for Word 2007 and Word 2010 (and higher to come...).

    It contains a task-pane with several listboxes of type System.Windows.Controls.Listbox. Part of the addin is to react, if something is dragged from one of the listboxes and dropped onto another. I can provide code if needed.

    Works fine on the developing machine (using Word 2007), the cursor switches from that circle with the diagonal line (stop sign?) to arrow when entering the second listbox and the code for the drop-event is executed.

    I tried on a testing machine with a clean installation (activated) of Office 2010. Here the second listbox refuses the drop, the cursor remains that stop sign and nothing else happens. A debug-output showed me, that the property "AllowDrop" of the second Listbox is still set to true.
    Same situation when I install SP1 for Office 2010.

    Now I uninstalled SP1 and it works!

    Version number is the same as before (14.0.4763.1000) but the size of the Installation differs (clean: 889MB, SP1 installed&uninstalled 936MB).

    Another testing machine has a clean installation of Office 2007, and the error occurs too. After installing SP2 for Office 2007 (error remains) here I cannot uninstall it seperately and therefore the Addin doesnt work here at all.

    Which files are affected by that installing and uninstalling of SP1 for Office 2010? I would like to provide them in my setup for the case of clean installations or SP1 installed. What can I do to avoid the error in Word 2007?

    I can provide a setup für the Addin as well...

     

    Cheers,
    Micha


    • Edited by MH_dhs Tuesday, September 13, 2011 1:58 PM
    • Moved by Cindy Meister MVPModerator Wednesday, September 14, 2011 10:41 AM VSTO-specific (From:Word for Developers)
    Tuesday, September 13, 2011 1:54 PM

All replies

  • Hi Micha

    Is this a VSTO add-in or a "Shared Add-in"? If it's a VSTO add-in I should move it to the VSTO forum.


    Cindy Meister, VSTO/Word MVP
    Tuesday, September 13, 2011 2:16 PM
    Moderator
  • Jupp, it is a VSTO-Addin. Move wherever you consider as appropriate...

    Cheers,
    Micha

    Wednesday, September 14, 2011 9:16 AM
  • Hi MH_dhs,

     

    Thanks for posting in the MSDN Forum.

     

    Would you please show me some snippets to reproduce your issue? I think the snippet will let us understand your issue better.

     

    Have a good day,

     

    Tom


    Tom Xu [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Tuesday, September 20, 2011 6:56 AM
    Moderator
  • Thx for the reply...

    Didnt forget the thread (neither solved the issue). Gonna create a little Addin with the faulty parts only. Follows up...

    Cheers, MH_dhs

    Tuesday, September 27, 2011 8:53 AM
  •  

    Hi folks,

    interesting change while creating that little Addin with the faulty parts only:

    -didnt create a related VS-setup project in the beginning but published via right click on my project -> publish
    -the drag'n'drop-feature worked then (for Word07 and Word10, clean installation)

    -now created a VS-setup-project (used the same as in the original Addin), built the whole project, installed
    -d'n'd-feature didnt work for Word07 and Word10, clean installation
    -but worked on the machine with Word10, SP1 installed and uninstalled.

    Which setup-settings might affect single features of the Addin? Which changes are made to executing the addin by installing and uninstalling the SP1?

    The XAML-Code for the source-Listbox is

     

    <ListBox Grid.Row="2"
                  Grid.Column="0"
                   Margin="0,0,0,0"
                   Height="116"
                   Width="550"
                   Name="lbxTemplate"
                  ItemsSource="{Binding Source={StaticResource templateListSource}}"
                  ScrollViewer.CanContentScroll="False"
                  FlowDirection="LeftToRight"
                  GotFocus="lbxAll_GotFocus"
                  MouseMove="lbxAll_MouseMove"
                  MouseLeftButtonUp="lbxAll_MouseLeftButtonUp"
                  PreviewMouseLeftButtonDown="lbxAll_PreviewMouseLeftButtonDown">
      <ListBox.ItemsPanel>
        <ItemsPanelTemplate>
          <VirtualizingStackPanel Orientation="Horizontal"
                                                IsItemsHost="True"/>
        </ItemsPanelTemplate>
      </ListBox.ItemsPanel>
      <ListBox.ItemTemplate>
        <DataTemplate DataType="myTemplate">
          <StackPanel Orientation="Horizontal">
            <Label Width="10"/>
              <StackPanel VerticalAlignment="Center">
                <Image Source="{Binding ThumbnailPath}"
                             Height="65"/>
                <TextBlock Text="{Binding NameInfo}"
                                  TextWrapping="Wrap"
                                  TextTrimming="WordEllipsis" />
              </StackPanel>
              <Label Width="10"/>
            </StackPanel>
          </DataTemplate>
        </ListBox.ItemTemplate>
      </ListBox>
    


    The destination Listbox is some sort of similar with an inner Listbox for every item of the outer Listbox...

     

    <ListBox Grid.Row="4"
                   Grid.Column="0"
                   Margin="0,0,0,0" 
                   Height="231"
                   Width="550"		
                   Name="lbxCombination"
                   ItemsSource="{Binding Source={StaticResource combinationListSource}}"
                   ScrollViewer.CanContentScroll="False"
                   HorizontalContentAlignment="Stretch"
                   FlowDirection="LeftToRight"
                   AllowDrop="True"
                   Drop="lbxCombination_Drop"
                   PreviewMouseLeftButtonDown="lbxCombination_Click"
                   MouseDoubleClick="lbxCombination_MouseDoubleClick">
      <ListBox.GroupStyle>
        <GroupStyle HeaderTemplate="{StaticResource combinationListTemplate}" />
      </ListBox.GroupStyle>
        <ListBox.ItemTemplate>
          <DataTemplate DataType="myCombination">
            <StackPanel Orientation="Horizontal">
              <TextBlock Text="{Binding TemplateName}"
                               Width="80"
                               TextWrapping="Wrap" 
                               VerticalAlignment="Center"/>
              <Border BorderThickness="1"
                      BorderBrush="Black"	/>
              <!--Inner Listbox-->
              <ListBox Margin="0,0,0,0"
                             BorderThickness="0"
                             ItemsSource="{Binding Pictures}" 
                             Drop="innerListBox_Drop" 
                             SelectionChanged="innerListBox_SelectionChanged">
                <ListBox.ItemsPanel>
                  <ItemsPanelTemplate>
                    <WrapPanel Orientation="Horizontal"/>
                  </ItemsPanelTemplate>
                </ListBox.ItemsPanel>
                <ListBox.ItemTemplate>
                  <DataTemplate DataType="myPicture">
                    <Image Source="{Binding PicturePath}"
                                 Height="50"/>
                  </DataTemplate>
                </ListBox.ItemTemplate>
              </ListBox>
            </StackPanel>
          </DataTemplate>
        </ListBox.ItemTemplate>
      </ListBox>
    


    The problem occurs for the Drop-Event of the outer Listbox.

    The Drag is performed as follows

     

    private void lbxAll_PreviewMouseLeftButtonDown( object sender, MouseButtonEventArgs e ) {
      ( ( Controls.ListBox )sender ).Focus();
      System.Drawing.Size p_DragSize = SystemInformation.DragSize;
      m_DragBox = new System.Drawing.Rectangle( new System.Drawing.Point( ( int )e.GetPosition( ( Controls.ListBox )sender ).X - ( p_DragSize.Width / 2 ), 
    ( int )e.GetPosition( ( Controls.ListBox )sender ).Y - ( p_DragSize.Height / 2 ) ), p_DragSize ); m_SendListBox = ( Controls.ListBox )sender; object p_oData = GetObjectDataFromPoint( m_SendListBox, new System.Windows.Point( ( int )e.GetPosition( m_SendListBox ).X, ( int )e.GetPosition( m_SendListBox ).Y ) ); if( p_oData != null ) { if( m_SendListBox == lbxTemplate ) lbxTemplate.SelectedItem = p_oData; try { DragDrop.DoDragDrop( m_SendListBox, p_oData, System.Windows.DragDropEffects.All ); } catch( Exception ex ) {  Fehler.showError( Fehler.Codes.E_DEFAULT, ex.Message ); } } }


    For the drop I expect the code in lbxCombination_Drop to be executed and before that, of course, the mouse cursor to change into an "Accept"-sign when hitting the destination Listbox. None of both happens on the Word07 and Word10 Machine when installed via the setup-project. I can upload both installation packs (setup project and publish-button) if necessary... Any hints for the code?

    Any guesses (educated) to the questions:

    Which setup-settings might affect single features of the Addin?
    Which changes are made to executing the addin by installing and uninstalling the SP1?

    Cheers, MH_dhs

     

     





    • Edited by MH_dhs Wednesday, September 28, 2011 12:07 PM
    Wednesday, September 28, 2011 11:38 AM