Select to view content in your preferred language

Search textbox : Object reference not set to an instance of an object

1221
3
02-20-2020 07:54 AM
servicesigu
Occasional Contributor

Hi,

In VS2017 with ArcGis pro 2.5 SDK,

when i try to add a search textbox to a new dockpane, this error happens

Object reference not set to an instance of an object

Search textbox

The Search TextBox control is a custom search control in ArcGIS.Desktop.Framework.dll that provides an optional search history menu.

xmlns:controls="clr-namespace:ArcGIS.Desktop.Framework.Controls;assembly=ArcGIS.Desktop.Framework" <controls:SearchTextBox InfoText="Search features" SearchMode="Manual" Search="SearchTextBox_Search" Width="200"/>

It's the same with with a BurgerButton.

What is wrong  for me ?

Is there someone else in the same case?

Thanks in advance for you reply.

0 Kudos
3 Replies
UmaHarano
Esri Regular Contributor

Hi

Were you able to compile your project? I was able to compile your attached project. I was also able to see your search control on the dockpane in Pro.

I have seen these type of errors show up in the Visual Studio Designer  - There a few hits on Google search about these too.  

In fact, on Visual Studio 2019, your project did not show these errors.  I think you can safely ignore them and still work with those controls.

Thanks

Uma

0 Kudos
servicesigu
Occasional Contributor

Hi,

Thank you for your reply.

Sorry for my late post, but I'm back to office only today.

I have verified, I'm able to compile my project, but i don't see the search control, in fact no controls present on the dockpane. Not very easy to design  the dockpane ! And it's not planned to use Visual Studio 2019.

SF

0 Kudos
by Anonymous User
Not applicable

Hi service sigu‌,

I believe you can open the dockpane already.

Based on your dockpane2.xaml, it is overlapped with textblock, so that you can't really see it.

Replace your Grid tag with below snippet and try again in arcgis pro. Design view in Visual studio for that xaml coding will not display correctly as always.

What I have changed? => I added additional row and specify your searchtextbox the row no to display. Grid.Row="1".

Let me know how's go.

  <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>
        
        <DockPanel Grid.Row="0" LastChildFill="true" KeyboardNavigation.TabNavigation="Local" Height="30">
            <TextBlock Grid.Column="1" Text="{Binding Heading}" Style="{DynamicResource Esri_TextBlockDockPaneHeader}">
                <TextBlock.ToolTip>
                    <WrapPanel Orientation="Vertical" MaxWidth="300">
                        <TextBlock Text="{Binding Heading}" TextWrapping="Wrap"/>
                    </WrapPanel>
                </TextBlock.ToolTip>
            </TextBlock>
        </DockPanel>
        <controls:SearchTextBox Grid.Row="1" >
        </controls:SearchTextBox>
    </Grid>‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

Best Regards,

Than

0 Kudos