Home Forums WPF controls Xceed DataGrid for WPF Make sure SelectedIndex is Visible

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • User (Old forums)
    Member
    Post count: 23064
    #24628 |

    I’m using TableView. When the user presses the up or down arrow, I’m calling Grid.SelectedIndex++ (or –, respectively). Eventually the selected row disappears off the bottom of the grid. (I just need to scroll down to see it).

    Is there a way to force the selected row to be visible? Or force a row to be visible?

    Imported from legacy forums. Posted by Brian (had 1347 views)

    Xceed Support
    Member
    Post count: 5658

    grid.SelectedIndex++;
    grid.BringItemIntoView( grid.SelectedItem );

    Imported from legacy forums. Posted by Marcus [Xceed] (had 357 views)

    User (Old forums)
    Member
    Post count: 23064

    Marcus,

    BringItemIntoView doesn’t cause the DataGrid to scroll. Any ideas on why? I am binding to a DataGridCollectionViewSource.

    Here is my XAML declaration:

    <xcdg:DataGridControl x:Name=”SearchResults”
    CellEditorDisplayConditions=”None”
    EditTriggers=”None”
    ItemScrollingBehavior=”Immediate” AutoCreateColumns=”False”
    ItemsSource=”{Binding Source={StaticResource searchDataView}, Path=View}”
    Margin=”2.22,0,1.86,0.6″
    VerticalAlignment=”Stretch” HorizontalAlignment=”Stretch” Height=”Auto”
    >
    <xcdg:DataGridControl.Resources>
    <!– These implicit styles that are local to this DataGridControl are an
    elegant way to set some desired default values of various grid elements. –>
    <ResourceDictionary>
    <Style TargetType=”xcdg:GroupByControl”>
    <Setter Property=”AllowGroupingModification”
    Value=”True”/>
    <Setter Property=”AllowSort”
    Value=”True”/>
    </Style>

    <Style TargetType=”xcdg:ColumnManagerRow”>
    <Setter Property=”AllowSort”
    Value=”True”/>
    <Setter Property=”AllowColumnReorder”
    Value=”True”/>
    </Style>
    </ResourceDictionary>
    </xcdg:DataGridControl.Resources>
    <xcdg:DataGridControl.View>
    <xcdg:TableView>
    <xcdg:TableView.FixedHeaders>

    <xcdg:ClearHeadersFooters/>

    <DataTemplate>
    <xcdg:ColumnManagerRow/>
    </DataTemplate>

    </xcdg:TableView.FixedHeaders>
    </xcdg:TableView>
    </xcdg:DataGridControl.View>

    <xcdg:DataGridControl.Columns>
    <!–<xcdg:Column FieldName=”Custid” Title=”Cust #”
    Width=”50″/>–>
    <xcdg:Column FieldName=”Orderid” Title=”Order ID”
    Width=”65″/>
    <xcdg:Column FieldName=”Shiporg” Title=”Org”
    Width=”100″/>
    <xcdg:Column FieldName=”Shipattn” Title=”Contact”
    Width=”100″/>
    <xcdg:Column FieldName=”Shipzip” Title=”Zip”
    Width=”65″/>
    <xcdg:Column FieldName=”Shipcity” Title=”City”
    Width=”65″/>
    <xcdg:Column FieldName=”Shipstate” Title=”State”
    Width=”50″/>
    <xcdg:Column FieldName=”Daterecved” Title=”Recd”
    Width=”65″/>
    <xcdg:Column FieldName=”Totalcnt” Title=”# Items”
    Width=”65″/>
    <xcdg:Column FieldName=”Purchordno” Title=”PO #”
    Width=”65″/>
    <xcdg:Column FieldName=”Nocharge” Title=”N/C”
    Width=”40″/>
    </xcdg:DataGridControl.Columns>
    </xcdg:DataGridControl>

    Imported from legacy forums. Posted by Brian (had 439 views)

    User (Old forums)
    Member
    Post count: 23064

    I found the problem. I was using SelectedIndex instead of SelectedItem in the SearchResults.SelectedItem() call.

    Imported from legacy forums. Posted by Brian (had 3253 views)

    User (Old forums)
    Member
    Post count: 23064

    It seems to be working bt the left arrow doesn’t change it position from the “unselected” item to the selected item.

    Greetings

    Imported from legacy forums. Posted by charlymoon (had 2124 views)

Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.