This project is read-only.

Hide search box

Feb 3, 2012 at 3:52 AM

hi,

Is there a way to Hide the search Box?

Thanks

Feb 21, 2012 at 7:08 PM

Yes I have done this, and the type property as well (I'll post a Patch sometime)

Here are the details for PropertyGrid.cs

        #region Show Search Property

        /// <value>Identifies the ShowSearch dependency property</value>
        public static DependencyProperty ShowSearchProperty =
            DependencyProperty.Register("ShowSearch", typeof(bool), typeof(PropertyGrid),
                                        new FrameworkPropertyMetadata(false));

        /// <value>description for ShowSearch property</value>
        public bool ShowSearch
        {
           get { return (bool)GetValue(ShowSearchProperty); }
           set { SetValue(ShowSearchProperty, value); }
        }

        #endregion

        #region Show Type Property

        /// <value>Identifies the ShowType dependency property</value>
        public static DependencyProperty ShowTypeProperty =
            DependencyProperty.Register("ShowType", typeof(bool), typeof(PropertyGrid),
                                        new FrameworkPropertyMetadata(false));

        /// <value>description for ShowType property</value>
        public bool ShowType
        {
           get { return (bool)GetValue(ShowTypeProperty); }
           set { SetValue(ShowTypeProperty, value); }
        }

        #endregion

And here are the details for PropertyGrid.Xaml (I'm sure you will be able to work out their locations)

								<DockPanel Grid.Column="0">
                              <DockPanel DataContext="{TemplateBinding local:PropertyGrid.ShowType}" DockPanel.Dock="Top" Margin="6 2 0 4">
										<TextBlock DockPanel.Dock="Left" Name="PART_InstanceType" FontWeight="Bold" Style="{DynamicResource {ComponentResourceKey TypeInTargetAssembly={x:Type local:PropertyGrid}, ResourceId=TextBlockStyle}}"></TextBlock>
										<TextBlock Width="6" DockPanel.Dock="Left" Style="{DynamicResource {ComponentResourceKey TypeInTargetAssembly={x:Type local:PropertyGrid}, ResourceId=TextBlockStyle}}">:</TextBlock>
										<TextBlock DockPanel.Dock="Left" Name="PART_InstanceName" Style="{DynamicResource {ComponentResourceKey TypeInTargetAssembly={x:Type local:PropertyGrid}, ResourceId=TextBlockStyle}}"></TextBlock>
                                 <DockPanel.Visibility>
                                    <Binding>
                                       <Binding.Converter>
                                          <BooleanToVisibilityConverter />
                                       </Binding.Converter>
                                    </Binding>
                                 </DockPanel.Visibility>
                              </DockPanel>
...
...
...
                                <TextBox DataContext="{TemplateBinding local:PropertyGrid.ShowSearch}" DockPanel.Dock="Left" Margin="8 0 8 0" Style="{DynamicResource {ComponentResourceKey TypeInTargetAssembly={x:Type local:PropertyGrid}, ResourceId=SearchTextBoxStyle}}" Text="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Filter, UpdateSourceTrigger=PropertyChanged}">
                                    <TextBox.Visibility>
                                       <Binding>
                                          <Binding.Converter>
                                             <BooleanToVisibilityConverter />
                                          </Binding.Converter>
                                       </Binding>
                                    </TextBox.Visibility>
                                 </TextBox>
									</DockPanel>