Select to view content in your preferred language

"The supplied buddy is not supported object" MapView Error message... HELP

932
2
10-04-2010 01:28 PM
KevinChan
Emerging Contributor
Hi All,

So I have been getting the
System.Runtime.InteropServices.COMException (0x-------) : The supplied buddy is not a supported object


When I try to set the tool bar and TOC as buddy of the mapHost:

                
//Buddy up controls
                tocControl.SetBuddyControl(mapControl);
                toolbarControl.SetBuddyControl(mapControl);


I have in the xaml side code I am using the AVALON DOCK code so I can put ArcGIS viewer into one of its dockable content.

Code is follows:

 <ad:DocumentPane x:Name="DocumentHost">
                        <ad:DockableContent x:Name="Scenario1" Title="Scenario1">
                            <!--<Grid>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="2*" />
                                    <ColumnDefinition Width="*" />
                                </Grid.ColumnDefinitions>-->
                                
                                <ad:DockingManager Grid.Column="1">
                                    <ad:ResizingPanel Orientation="Horizontal">
                                        <ad:DockablePane ad:ResizingPanel.ResizeWidth="100"/>
                                        <ad:DockablePane>
                                            <ad:DockableContent x:Name="InnerDoc1" Title="GIS" IsCloseable="False">
                                            <Grid Grid.Column="0">
                                                <arcMap:WindowsFormsHost Name="mapHost" Margin="0,30,0,22" />
                                                <arcMap:WindowsFormsHost Height="30" Name="toolbarHost" VerticalAlignment="Top" />
                                                <TextBlock Height="23.75" VerticalAlignment="Bottom" Name="textBlock1" Margin="0,0,7.056,0">Ready</TextBlock>
                                            </Grid>
                                        </ad:DockableContent>

                                            <ad:DockableContent x:Name="InnerDoc2" Title="TreeView"  IsCloseable="False">
                                                <Grid>

                                                </Grid>
                                            </ad:DockableContent>
                                        </ad:DockablePane>
                                    </ad:ResizingPanel>
                                </ad:DockingManager>
                            <!--</Grid>-->
                        </ad:DockableContent>

                    </ad:DocumentPane>


When I have the arcMap control where it is now... it will crash and give me the error... but if I uncommented the Grid control at the top and placed the

 <Grid Grid.Column="0">
                                                <arcMap:WindowsFormsHost Name="mapHost" Margin="0,30,0,22" />
                                                <arcMap:WindowsFormsHost Height="30" Name="toolbarHost" VerticalAlignment="Top" />
                                                <TextBlock Height="23.75" VerticalAlignment="Bottom" Name="textBlock1" Margin="0,0,7.056,0">Ready</TextBlock>
                                            </Grid>


right below the commented grid code then it works fine.

I thought it threw error because I can't put the map host inside the custom control. But it works if I just move it up 1 level.

Any idea guys?

Please some expert out there PLEASE PLEASE help me ><.....
0 Kudos
2 Replies
KevinChan
Emerging Contributor
bump...

anyone.. please help....
0 Kudos
KevinChan
Emerging Contributor
Solved:

Issue was that control weren't fully loaded, hence active x would get back at me.

Fixed by adding
{AxMapControl}.CreateControl();
{AxPageLayoutControl}.CreateControl();
{AxToolbarControl}.CreateControl();
{AxTOCControl}.CreateControl();
0 Kudos