Home Forums WPF controls Xceed DataGrid for WPF Add Fixedfooter is not working

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

    Hello,

    I´am trying to add programaticaly
    FixedFooters and GroupLevel Configuracion with the folow code :

    DataGrid.View.FixedFooters.Add((DataTemplate)this.FindResource(“tableViewFixedFooter1”));
    DataGrid.View.GroupLevelConfigurations.Add((GroupLevelConfiguration)this.FindResource(“tableViewGroupLevelConfiguration1”));

    I use the TAbleViewTemplate.Xaml fom the StatFunction example.
    but when i debug my app, nothings happen after my two adds !!

    Here an extract from my template :

    <DataTemplate x:Key=”tableViewFixedFooter1″>
    <xcdg:StatRow>
    <xcdg:StatRow.Resources>
    <Style TargetType=”xcdg:StatCell”
    BasedOn=”{StaticResource tableViewTotalStatCellStyle}”/>
    </xcdg:StatRow.Resources>

    <!– Each StatCell has a default StatResultConverter assigned to it,
    allowing only a ConverterParameter that will format
    the result to be specified. To improve its usage in XAML, the StatResultConverter’s
    parameter supports a simplified syntax of composite formatting.
    Refer to the documentation for more informations. –>
    <xcdg:StatCell FieldName=”Katy”
    ResultPropertyName=”Sum_Katy”
    ResultConverterParameter=”[c] (avg)”/>
    </xcdg:StatRow>
    </DataTemplate>

    And in my Page.xaml i have

    <ResourceDictionary>
    <ResourceDictionary.MergedDictionaries>
    <!– This xaml defines the header and footer templates used in table view –>
    <ResourceDictionary Source=”ResourceDictionaryDG.xaml”/>
    </ResourceDictionary.MergedDictionaries>

    <xcdg:DataGridCollectionViewSource x:Key=”MaybeHereisMyProblem” >
    <xcdg:DataGridCollectionViewSource.StatFunctions>
    <xcdg:SumFunction ResultPropertyName=”Sum_Katy” SourcePropertyName=”Sum_Katy”/>
    </xcdg:DataGridCollectionViewSource.StatFunctions>
    </xcdg:DataGridCollectionViewSource>

    <xcdg:StatResultConverter x:Key=”valueConverter”/>
    </ResourceDictionary>

    I perform the bindding to the data by code in Csharp, before the add of fixedfooter.

    _dataGridCollectionView = new DataGridCollectionView(ds.Tables[Table].DefaultView);
    DataGrid.ItemsSource = _dataGridCollectionView;

    Thanks for your help and responses.

    Imported from legacy forums. Posted by daniel (had 713 views)

    User (Old forums)
    Member
    Post count: 23064

    You think it´s a binding problem ?
    i don´t know how code to put in binding XAML secion if i am binding programaticaly at runtime.

    i apreceate your help

    Imported from legacy forums. Posted by daniel (had 224 views)

    User (Old forums)
    Member
    Post count: 23064

    no idea ?
    i apreceate your help.

    Thanks

    Imported from legacy forums. Posted by daniel (had 444 views)

    User (Old forums)
    Member
    Post count: 23064

    I find a problem :

    When i declare DataGridCollectionViewSource in Xaml, i can´t bind tis colllection in XAML because i add programaticaly the itemsource to a datatable after the grid is create blank.

    i think there is the problem because in Xaml i define in DataGridCollectionViewSource the StatFunctions related to a ResultPropertyName and a SourcePropertyName that doesn´t exist yet, in the collection.

    <xcdg:DataGridCollectionViewSource x:Key=”MaybeHereisMyProblem” >
    <xcdg:DataGridCollectionViewSource.StatFunctions>
    <xcdg:SumFunction ResultPropertyName=”Sum_Katy” SourcePropertyName=”Sum_Katy”/>
    </xcdg:DataGridCollectionViewSource.StatFunctions>
    </xcdg:DataGridCollectionViewSource>

    How can i solve this issue, because when i add, fixed GroupLevelConfigurations and footers to the view, like this:

    DataGrid.View.FixedFooters.Add((DataTemplate)this.FindResource(“tableViewFixedFooter1”));
    DataGrid.View.GroupLevelConfigurations.Add((GroupLevelConfiguration)this.FindResource(“tableViewGroupLevelConfiguration1”));

    Nothing happen, no exceptions are thronw .

    Thanks for your help.

    Imported from legacy forums. Posted by daniel (had 489 views)

    Xceed Support
    Member
    Post count: 5658

    The problem is that you are not binding the DataGrid.ItemsSource to the DataGridCollectionView defined in your XAML…

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

    Xceed Support
    Member
    Post count: 5658

    As for the GroupLevelConfiguration problem, in order to help you, you will need to post the xaml of the GroupLevelConfiguration as well as what is the expected result when you are grouping.

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

    User (Old forums)
    Member
    Post count: 23064

    Excuse me i forgot this Xaml code :

    <Setter Property=”BorderBrush”
    Value=”{xcdg:ViewBinding HorizontalGridLineBrush}”/>

    <Setter Property=”Template”>
    <Setter.Value>
    <ControlTemplate TargetType=”xcdg:StatCell”>
    <Border Background=”{TemplateBinding Background}”
    BorderBrush=”{TemplateBinding BorderBrush}”
    BorderThickness=”{TemplateBinding BorderThickness}”
    Padding=”{TemplateBinding Padding}”>
    <StackPanel>
    <Border x:Name=”totalBorder”
    BorderBrush=”{TemplateBinding BorderBrush}”
    BorderThickness=”0,1,0,0″/>

    <ContentPresenter Content=”{xcdg:CellContentBinding}”
    ContentTemplate=”{TemplateBinding ContentTemplate}”
    ContentTemplateSelector=”{TemplateBinding ContentTemplateSelector}”
    HorizontalAlignment=”{TemplateBinding HorizontalContentAlignment}”
    VerticalAlignment=”{TemplateBinding VerticalContentAlignment}” />
    </StackPanel>
    </Border>

    <ControlTemplate.Triggers>

    <DataTrigger Binding=”{Binding RelativeSource={RelativeSource Self}, Path=ParentColumn.Visible}”
    Value=”False”>
    <Setter Property=”Visibility”
    Value=”Collapsed”/>
    </DataTrigger>

    <!– When the StatCell is not inside a Group, display a double line. –>
    <Trigger Property=”xcdg:GroupLevelIndicatorPane.GroupLevel”
    Value=”-1″>
    <Setter TargetName=”totalBorder”
    Property=”BorderThickness”
    Value=”0,1,0,1″/>

    <Setter TargetName=”totalBorder”
    Property=”Padding”
    Value=”0,2,0,0″/>
    </Trigger>

    <!– When the StatCell has no content, don’t display any line above. –>
    <Trigger Property=”HasContent”
    Value=”False”>
    <Setter TargetName=”totalBorder”
    Property=”BorderThickness”
    Value=”0″/>
    </Trigger>
    </ControlTemplate.Triggers>
    </ControlTemplate>
    </Setter.Value>
    </Setter>
    </Style>

    <xcdg:GroupLevelConfiguration x:Key=”tableViewGroupLevelConfiguration1″>
    <xcdg:GroupLevelConfiguration.Footers>
    <!– The groups will contain a StatRow visible even when the group
    is collapsed. –>
    <xcdg:GroupHeaderFooterItemTemplate VisibleWhenCollapsed=”True”>
    <DataTemplate>
    <xcdg:StatRow>
    <!– The following three cells simply refer to the previously
    declared StatFunctions using the ResultPropertyName property. –>
    <xcdg:StatCell FieldName=”Katy”
    ResultPropertyName=”Sum_Katy”
    Style=”{StaticResource tableViewTotalStatCellStyle}”/>
    </xcdg:StatRow>
    </DataTemplate>
    </xcdg:GroupHeaderFooterItemTemplate>
    </xcdg:GroupLevelConfiguration.Footers>
    </xcdg:GroupLevelConfiguration>

    I´am specting the same result than in Xceed StatFunction sample.
    I mean to have a statRow visible even the group is collapsed

    Imported from legacy forums. Posted by daniel (had 431 views)

    User (Old forums)
    Member
    Post count: 23064

    As for binding, i change my zaml code to this :

    <UserControl x:Class=”GMS_APP.DaylyInfo.DataGridView”
    xmlns=”http://schemas.microsoft.com/winfx/2006/xaml/presentation&#8221;
    xmlns:xcdg=”http://schemas.xceed.com/wpf/xaml/datagrid&#8221;
    xmlns:x=”http://schemas.microsoft.com/winfx/2006/xaml&#8221;
    xmlns:compModel=”clr-namespace:System.ComponentModel;assembly=WindowsBase”
    xmlns:my=”clr-namespace:System;assembly=mscorlib”
    Height=”364.276666666667″ Width=”756.976666666667″>
    <UserControl.Resources>
    <ResourceDictionary>
    <ResourceDictionary.MergedDictionaries>
    <!– This xaml defines the header and footer templates used in table view –>
    <ResourceDictionary Source=”ResourceDictionaryDG.xaml”/>
    </ResourceDictionary.MergedDictionaries>

    <xcdg:DataGridCollectionViewSource x:Key=”DataSource” >
    <xcdg:DataGridCollectionViewSource.StatFunctions>
    <xcdg:SumFunction ResultPropertyName=”Sum_Katy” SourcePropertyName=”Sum_Katy”/>
    </xcdg:DataGridCollectionViewSource.StatFunctions>
    </xcdg:DataGridCollectionViewSource>

    <xcdg:StatResultConverter x:Key=”valueConverter”/>
    </ResourceDictionary>
    </UserControl.Resources>
    <Grid>
    <xcdg:DataGridControl Name=”DataGrid”
    NavigationBehavior=”RowOrCell”
    Margin=”0,0,1,0″
    ItemsSource=”{Binding Source={StaticResource DataSource}, Path=View}”>
    <xcdg:DataGridControl.View>
    <xcdg:TableView>
    <xcdg:TableView.Theme>
    <xcdg:AeroNormalColorTheme/>
    </xcdg:TableView.Theme>
    </xcdg:TableView>
    </xcdg:DataGridControl.View>
    </xcdg:DataGridControl>
    </Grid>
    </UserControl>

    i have no better result, i have stats row displaying at the screen.
    When i set the datasource of the DataGrid i am building an other instance of DataGridCollectionViewSource !!! and is for that my solution is not working ?

    _dataGridCollectionView = new DataGridCollectionView(ds.Tables[0].DefaultView);

    // Bind the grid to the Xceed DataGridCollectionView.
    DataGrid.ItemsSource = _dataGridCollectionView;

    Imported from legacy forums. Posted by daniel (had 527 views)

    User (Old forums)
    Member
    Post count: 23064

    I change some lines to this :

    _dataGridCollectionView = (DataGridCollectionViewSource)this.FindResource(“DataSource”);

    _dataGridCollectionView.Source = ds.Tables[Table].DefaultView;

    // Bind the grid to the Xceed DataGridCollectionView.
    DataGrid.ItemsSource = _dataGridCollectionView.View;

    Where Datasource is the key of my DataGridCollectionViewSource define in xaml

    <xcdg:DataGridCollectionViewSource x:Key=”DataSource” >
    <xcdg:DataGridCollectionViewSource.StatFunctions>
    <xcdg:SumFunction ResultPropertyName=”Sum_Katy” SourcePropertyName=”Sum_Katy”/>
    </xcdg:DataGridCollectionViewSource.StatFunctions>
    </xcdg:DataGridCollectionViewSource>

    I have, no stat rows yet !!!!

    Can you help me to solv this issue.
    Thanks

    Imported from legacy forums. Posted by daniel (had 440 views)

    User (Old forums)
    Member
    Post count: 23064

    Can you put me in the good direction please.

    Thanks

    Imported from legacy forums. Posted by daniel (had 392 views)

    Xceed Support
    Member
    Post count: 5658

    Hi danisam,

    Based on your most recent posts, you did not add any StatRow in the headers/footers region of the grid…

    I suggest starting from the examples from this documentation page for complete guidance on how to display stat functions.

    <a href=”http://doc.xceedsoft.com/products/XceedWpfDataGrid/Statistical%20Functions.html”>http://doc.xceedsoft.com/products/XceedWpfDataGrid/Statistical%20Functions.html</a&gt;

    Note: To benefit from the Stat Functions features, you will need a Vanguard subscription license, for more details, please refer to this page:

    <a href=”http://xceed.com/Grid_WPF_Features.html”>http://xceed.com/Grid_WPF_Features.html</a&gt;

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

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