Home Forums WPF controls Xceed DataGrid for WPF lots of whitespace above and below groups.. no group label

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

    hello,

    i am now trying to work on some grouping stuff and have run into a strange problem, but its most likely me doing something wrong. here is some example code:

    <xcdg:DataGridCollectionViewSource x:Key=”userData” Source=”{Binding Source={StaticResource UserCollectionDS}}” >
    <xcdg:DataGridCollectionViewSource.GroupDescriptions>
    <xcdg:DataGridGroupDescription PropertyName=”Location”/>

    </xcdg:DataGridCollectionViewSource.GroupDescriptions>

    </xcdg:DataGridCollectionViewSource>
    <DataTemplate DataType=”{x:Type xcdg:Group}”>
    <StackPanel Orientation=”Horizontal”>
    <TextBlock Text=”The “/>
    <TextBlock Text=”{Binding Value}”/>
    <TextBlock Text=” group contains “/>
    <TextBlock Text=”{Binding Items.Count}”/>
    <TextBlock Text=” items.”/>
    </StackPanel>
    </DataTemplate>

    <xcdg:DataGridControl x:Name=”userGrid” Margin=”8,29.96,8,8″ ItemsSource=”{Binding Mode=OneWay, Source={StaticResource userData}}” ItemTemplate=”{DynamicResource UserCollectionTemplate1}” HorizontalContentAlignment=”Stretch” VerticalContentAlignment=”Stretch”>
    <xcdg:DataGridControl.ContextMenu>
    <ContextMenu >
    <MenuItem Header=”Properties…” x:Name=”rightClickMenu”/>
    </ContextMenu>
    </xcdg:DataGridControl.ContextMenu>
    <xcdg:DataGridControl.Columns>
    <xcdg:Column FieldName=”FirstName” VisiblePosition=”0″ Title=”First Name”/>
    <xcdg:Column FieldName=”LastName” VisiblePosition=”1″/>
    <xcdg:Column FieldName=”Title” VisiblePosition=”2″/>
    <xcdg:Column FieldName=”LocationName” Title=”Location” DisplayMemberBinding=”{Binding Path=Location1.LocName}” VisiblePosition=”3″/>
    </xcdg:DataGridControl.Columns>

    <xcdg:DataGridControl.View>
    <xcdg:TableView FixedColumnCount=”4″>

    <xcdg:TableView.FixedHeaders>
    <xcdg:ClearHeadersFooters/>
    <DataTemplate>
    <xcdg:ColumnManagerRow AllowColumnReorder=”False” AllowAutoFilter=”True”/>

    </DataTemplate>
    <DataTemplate>
    <xcdg:GroupByControl AllowSort=”true” AllowGroupingModification=”true” />
    </DataTemplate>
    </xcdg:TableView.FixedHeaders>

    </xcdg:TableView>

    </xcdg:DataGridControl.View>

    </xcdg:DataGridControl>

    when i used the above code, the data does group correctly, but there are several blank lines above and below each group, with no group labels or anything. i can provide a screen shot if that would be helpful. what am i missing to make this work?

    Imported from legacy forums. Posted by Jason (had 4398 views)

    Xceed Support
    Member
    Post count: 5658

    A screenshot would help diagnose the problem 🙂 You can send it to me at belandj@xceedsoft.com

    Imported from legacy forums. Posted by Jenny [Xceed] (had 314 views)

    User (Old forums)
    Member
    Post count: 23064

    actually i fixed the original problem. i was using some ItemTemplate that Blend generated which caused things to get messed up when i tried the grouping. so the grouping now displays correctly, except that the group label comes up blank.

    here is the updated code to illustrate how everything is working now. perhaps someone can see where i am going wrong. thanks.

    <Page.Resources>

    <ObjectDataProvider x:Key=”UserCollectionDS” d:IsDataSource=”True” ObjectType=”{x:Type Reprise_Inventory_Console_CustomCollections:UserCollection}”/>

    <DataTemplate x:Key=”locationGroupTemplate”>
    <TextBlock Text=”{Binding Path=Location.LocName}”/>

    </DataTemplate>
    </Page.Resources>

    <Grid Height=”Auto” HorizontalAlignment=”Left” VerticalAlignment=”Top”>
    <Grid.Resources>
    <xcdg:DataGridCollectionViewSource x:Key=”userData” Source=”{Binding Source={StaticResource UserCollectionDS}}” >
    <xcdg:DataGridCollectionViewSource.GroupDescriptions>
    <xcdg:DataGridGroupDescription PropertyName=”Location”/>

    </xcdg:DataGridCollectionViewSource.GroupDescriptions>

    </xcdg:DataGridCollectionViewSource>

    </Grid.Resources>
    <Label Content=”Label” Width=”Auto” Height=”Auto” VerticalAlignment=”Top” HorizontalAlignment=”Left”/>

    <xcdg:DataGridControl x:Name=”userGrid” Margin=”8,29.96,8,8″ ItemsSource=”{Binding Mode=OneWay, Source={StaticResource userData}}” HorizontalContentAlignment=”Stretch” VerticalContentAlignment=”Stretch”>
    <xcdg:DataGridControl.ContextMenu>
    <ContextMenu >
    <MenuItem Header=”Properties…” x:Name=”rightClickMenu”/>
    </ContextMenu>
    </xcdg:DataGridControl.ContextMenu>
    <xcdg:DataGridControl.Columns>
    <xcdg:Column FieldName=”FirstName” Title=”First Name”/>
    <xcdg:Column FieldName=”LastName” />
    <xcdg:Column FieldName=”Title” />
    <xcdg:Column FieldName=”Department” Title=”Department” DisplayMemberBinding=”{Binding Path=Department1.Name}”/>
    <xcdg:Column FieldName=”Location”
    Title=”Location”
    DisplayMemberBinding=”{Binding Path=Location1.LocName}”
    GroupValueTemplate=”{StaticResource locationGroupTemplate}”/>
    </xcdg:DataGridControl.Columns>

    <xcdg:DataGridControl.View>
    <xcdg:TableView FixedColumnCount=”5″>

    <xcdg:TableView.FixedHeaders>
    <xcdg:ClearHeadersFooters/>
    <DataTemplate>
    <xcdg:ColumnManagerRow AllowColumnReorder=”False” AllowAutoFilter=”True”/>

    </DataTemplate>
    <DataTemplate>
    <xcdg:GroupByControl AllowSort=”true” AllowGroupingModification=”true” />
    </DataTemplate>
    </xcdg:TableView.FixedHeaders>

    </xcdg:TableView>

    </xcdg:DataGridControl.View>

    </xcdg:DataGridControl>

    Imported from legacy forums. Posted by Jason (had 702 views)

    Xceed Support
    Member
    Post count: 5658

    Do you have any binding errors in your output window?

    Imported from legacy forums. Posted by Jenny [Xceed] (had 354 views)

    User (Old forums)
    Member
    Post count: 23064

    System.Windows.Data Error: 35 : BindingExpression path error: ‘Location1’ property not found on ‘object’ ”Int32′ (HashCode=1)’. BindingExpression:Path=Location1.Name; DataItem=’Int32′ (HashCode=1); target element is ‘TextBlock’ (Name=”); target property is ‘Text’ (type ‘String’)

    i’m using the same binding path that i use for the column display member. is this not correct?

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

    User (Old forums)
    Member
    Post count: 23064

    the group label shows up correctly if i use a property like Title or LastName, but if i try to use to a sub property of an object, Location1.LocName, Department1.Name, etc those don’t show up. so its got to be how im trying to access those values in the data template, but the same binding paths work fine in the data rows themselves.

    do i need to define the data templates in some other area besides Page.Resources?

    Imported from legacy forums. Posted by Jason (had 481 views)

    User (Old forums)
    Member
    Post count: 23064

    nevermind, i figured it out. i studied the SolidFoundation example and recreated the *IDDictionary lookup functionality and i now have labels on my groups as expected. a bit of legwork to get this implemented, but the result is worth it.

    thanks

    Imported from legacy forums. Posted by Jason (had 5765 views)

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