Home Forums WPF controls Xceed DataGrid for WPF Grid sizing issues

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

    I’ve run into a lot of problems with a databound grid not respecting the normal WPF behvaiors for layout. For instance, a small, two-column grid with HorizontalAlignment set to Left should only be taking up a couple of inches based on the data. However, even with absolutely no hard-coded widths anywhere, it defaults to half of the screen. Additionally, the vertical sizing seems to display some of the same issues based on the Grid’s scroll-bar never becoming enabled (and it allowing me to select right on down the grid, off the page).

    1 – Is this a known (and real) issue?
    2 – Is this going to improve in 1.1?
    3 – Is there any concise guidance on how to set the various attributes for an effective grid layout? Assume that I’d prefer not specify any numerical widths.

    Thanks!
    Eric

    Imported from legacy forums. Posted by Eric (had 4777 views)

    Xceed Support
    Member
    Post count: 5658

    Hi Eric,

    I’m going to take a look into this issue… In the mean time, can you share a little bit of your Grid Layouting code, in case it helps me nail the problem down.

    Thanks

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

    User (Old forums)
    Member
    Post count: 23064

    Our Xceed grid’s on a user control, which is then hosted in a grid on another user control. The hosting site is as follows. I’d like to be able to replace with Width=250 with Width=Auto
    <Grid>
    <Grid.ColumnDefinitions>
    <ColumnDefinition Width=”250″ />
    <ColumnDefinition />
    </Grid.ColumnDefinitions>

    <rics:StoreSelectionView Grid.Column=”0″ x:Name=”_selectionView”/>

    <GridSplitter> <!– … ->

    The User control is effectively as follows. I’d also like to remove the Width=50 from the code column, but I can’t until auto-sizing columns works (1.1???)

    <StackPanel>
    <!– couple of other controls here, with no sizing set –>
    <dg:DataGridControl
    x:Name=”StoreGrid”
    VerticalAlignment=”Stretch”
    AutoCreateColumns=”False”
    NavigationBehavior=”RowOnly”
    EditTriggers=”None”
    HideSelection=”True”
    ReadOnly=”True”
    >
    <dg:DataGridControl.Columns>
    <dg:Column
    FieldName=”Code”
    IsMainColumn=”True”
    Title=”Number”
    Width=”50″
    />
    <dg:Column
    FieldName=”Name”
    Title=”Store Name”
    />
    </dg:DataGridControl.Columns>
    <dg:DataGridControl.View>
    <dg:TableView
    ShowRowSelectorPane=”False”
    VerticalGridLineBrush=”Transparent”
    HorizontalGridLineBrush=”Transparent”
    Theme=”{DynamicResource defaultTheme}”
    >
    <dg:TableView.FixedHeaders>
    <dg:ClearHeadersFooters/>
    </dg:TableView.FixedHeaders>
    </dg:TableView>
    </dg:DataGridControl.View>
    </dg:DataGridControl>

    </StackPanel>

    Imported from legacy forums. Posted by Eric (had 428 views)

    Xceed Support
    Member
    Post count: 5658

    Thank you… we’ll take a look at this and let you know about our findings…

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

    User (Old forums)
    Member
    Post count: 23064

    I’ve got some more interesting behaviors you may be interested in surrounding this issue, but because they involve sharing screenshots and other things we’d rather not publicly share, could we continue this thread by email?
    erwilleke at csi-rics.com

    Imported from legacy forums. Posted by Eric (had 277 views)

    Xceed Support
    Member
    Post count: 5658

    Hi Eric,

    You can send your screenshots a support@xceedsoft.com with “For Marc” in the title.

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

    Xceed Support
    Member
    Post count: 5658

    Hi Eric,

    I saw your screenshots and noticed that the DataGridControl was not sizing itself to fit the size of your Tab control…

    I then took a minute to observe the XAML code for layouting the DataGridControl and noticed you placed it inside a StackPanel…

    As a Default behavior, a stack panel will layout its childs with infinity as size constraint… unless a restrictive parameter is set on the StackPanel… Therefore, the DataGridControl will take as much space as required to layout all its childs ( you then forfeit the UI Virtualization).

    This is symptomatic by seing that the bottom part of the horizontal scrollbar is not visible.

    To solve the strange scrolling issue, you can try removing the stackpanel. Or if you need to layout other elements along with the grid, use another kind of panel (grid, dockpanel)…

    When I have a second, i’ll take a look at your other issue.

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

    User (Old forums)
    Member
    Post count: 23064

    Actually, Marcus, that fixes all the scrolling issues I had… I’d never realized that StackPanel blocked the virtualization behavior by not being constrained… I replaced the StackDanel with a DockPanel with the other stuff in the view Docked to Top and the datagrid set as the last child with LastChildFill set to true.

    Things Scroll!

    Other question: Is column autofitting coming in any of the upcoming releases?

    Imported from legacy forums. Posted by Eric (had 6261 views)

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