Select to view content in your preferred language

FeatureDataForm scrollviewer -- bug?

1787
6
Jump to solution
06-23-2012 11:10 PM
JudyTroutwine
Regular Contributor
The xaml below seems straightforward; however, the scrollviewer for the FeatureDataForm shows only the vertical bar.  There are some wide fieds on the table records being partially displayed, and I tried various widths and heights for the form -- still no horizontal bar.  Also, hiding the vertical bar has no effect -- it is still visible.  Is this a bug?

<Border x:Name="FDFBorder" Visibility="Collapsed" Canvas.ZIndex="10" Grid.Row="2" IsHitTestVisible="True"
            Grid.Column="0" Grid.ColumnSpan="3"  Background="Transparent" CornerRadius="10"
            HorizontalAlignment="Left" VerticalAlignment="Top" Margin="10,10,0,0" Width="300" Height="400"
            BorderBrush="Transparent" BorderThickness="3"  >     
      <Canvas x:Name="FDFCanvas" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="0" Visibility="Visible" >
        <Grid x:Name="FDFGrid" HorizontalAlignment="Left" VerticalAlignment="Top" Width="300" Height="400"
                   Margin="0"  Visibility="Visible" Background="#CC5C90B2" Opacity="1.0"  IsHitTestVisible="True"
                       MouseEnter="Grid_MouseEnter" MouseLeave="Grid_MouseLeave"
                            MouseLeftButtonDown="Handle_MouseDown" GotFocus="Grid_GotFocus"
                            MouseMove="Handle_MouseMove" SizeChanged="FDFGrid_SizeChanged"
                            MouseLeftButtonUp="Handle_MouseUp">
          <Grid.Effect>
            <DropShadowEffect Color="Black" Direction="-45" BlurRadius="10" Opacity=".75" />
          </Grid.Effect>
          <StackPanel x:Name="FormSP" Orientation="Vertical" Background="#CC5C90B2" Visibility="Visible">
            <esri:FeatureDataForm x:Name="FDForm" Height="Auto" Width="Auto" Margin="10,10,10,10" Background="#CC5C90B2"
                             FontSize="10" PropertyChanged="FDForm_PropertyChanged" Visibility="Visible"
                                   FeatureLayer="{Binding Path=Layers[Trees], ElementName=MyMap}"
                             IsReadOnly="False" LabelPosition="Left" 
                                 ScrollViewer.HorizontalScrollBarVisibility="Visible" ScrollViewer.VerticalScrollBarVisibility="Visible"
                             TextInput="FDForm_TextInput" TextInputStart="FDForm_TextInputStart"
                             TextInputUpdate="FDForm_TextInputUpdate"  EditEnded="FDForm_EditEnded"
                             BorderBrush="Aquamarine" HorizontalAlignment="Left" VerticalAlignment="Top">
            </esri:FeatureDataForm>
            <Button x:Name="CloseForm" VerticalAlignment="Bottom" HorizontalAlignment="Right" Margin="0,5,25,5" Visibility="Visible"
                    Content="Close" Click="FDFClose_Click"/>
          </StackPanel>
        </Grid>
      </Canvas>
    </Border>
0 Kudos
1 Solution

Accepted Solutions
DominiqueBroux
Esri Frequent Contributor
<ScrollBar x:Name="HorizontalScrollBar" Grid.Column="0" Height="15" IsTabStop="False" Maximum="{TemplateBinding ScrollableWidth}" Margin="-1,0,-1,-1" Minimum="0" Orientation="Horizontal" Grid.Row="1" Visibility="Visible" Value="{TemplateBinding HorizontalOffset}" ViewportSize="{TemplateBinding ViewportWidth}"/>


There is not an "Auto" value allowed in this context.


You have to set HorizontalScrollBarVisibility="Auto" on the ScrollViewer  (not on the ScrollBar)

<ScrollViewer Style="{StaticResource CustomScrollViewerStyle}" IsTabStop="False"          Background="{x:Null}" Padding="{TemplateBinding Padding}"          VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto">     <ContentPresenter x:Name="ContentPresenter" Margin="12,12,6,12"/> </ScrollViewer>

View solution in original post

0 Kudos
6 Replies
DominiqueBroux
Esri Frequent Contributor
I don't know if it's a bug but by default the HorizontalScrollbarVisibility is not visible.

To change that you have to retemplate the FeatureDataForm.

You can use Expression Blend and right-click on your FeatureDataForm and select "Edit Template" --> "Edit a copy...", then you will get the default control template.
Look for the ScrollViewer and add HorizontalScrollBarVisibility="Auto"
0 Kudos
JudyTroutwine
Regular Contributor
Dominique,

I have a copy of the FeatureDataForm style resource.  I used that and simply edited thus

<ScrollBar x:Name="HorizontalScrollBar" Grid.Column="0" Height="15" IsTabStop="False" Maximum="{TemplateBinding ScrollableWidth}" Margin="-1,0,-1,-1" Minimum="0" Orientation="Horizontal" Grid.Row="1" Visibility="Visible"              Value="{TemplateBinding HorizontalOffset}" ViewportSize="{TemplateBinding ViewportWidth}"/>


There is not an "Auto" value allowed in this context.  The bar is now visible though with no slider. It seems something must be done to activate the bar.  Perhaps widening the textboxes in the FeatureDataForm would do the trick.  Can that be added to the style?
0 Kudos
DominiqueBroux
Esri Frequent Contributor
<ScrollBar x:Name="HorizontalScrollBar" Grid.Column="0" Height="15" IsTabStop="False" Maximum="{TemplateBinding ScrollableWidth}" Margin="-1,0,-1,-1" Minimum="0" Orientation="Horizontal" Grid.Row="1" Visibility="Visible" Value="{TemplateBinding HorizontalOffset}" ViewportSize="{TemplateBinding ViewportWidth}"/>


There is not an "Auto" value allowed in this context.


You have to set HorizontalScrollBarVisibility="Auto" on the ScrollViewer  (not on the ScrollBar)

<ScrollViewer Style="{StaticResource CustomScrollViewerStyle}" IsTabStop="False"          Background="{x:Null}" Padding="{TemplateBinding Padding}"          VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto">     <ContentPresenter x:Name="ContentPresenter" Margin="12,12,6,12"/> </ScrollViewer>
0 Kudos
JudyTroutwine
Regular Contributor
That solves it.  Thanks.
0 Kudos
JudyTroutwine
Regular Contributor
That said, I would like to customize the textboxes for other reasons.  The provided toolkit code does not include the xaml for the FeatureDataGrid.  Is it available somewhere?
0 Kudos
JoeHershman
MVP Alum
The FeatureDataGrid Xaml is in the FeatureDataGrid.Theme.xaml file of the toolkit
Thanks,
-Joe
0 Kudos