We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Bug in binding the text of the headerText in a stackedColumn

Thread ID:

Created:

Updated:

Platform:

Replies:

119318 Jun 4,2015 02:30 PM UTC Jun 19,2015 01:55 PM UTC WinRT 3
loading
Tags: SfDataGrid
Aurélien
Asked On June 4, 2015 02:30 PM UTC

Hi,

I want to bind the text value of headerText in a stackedColumn.

The first time, at initialization, the value is correctly taken into account. It is no more taken into account during the next changes.

Best regards.

Aurélien

Example :

<Page x:Name="pageRoot">

<Page.Resources>

<behaviour:NameScopeBinding x:Key="pageSource" Source="{Binding ElementName=pageRoot}"/>

</Page.Resources>


 <grid:SfDataGrid ItemsSource="{Binding ListDataTable}" AutoGenerateColumns="False" 

 BorderThickness="1" HorizontalAlignment="Right" ManipulationMode="System">


<grid:SfDataGrid.SortColumnDescriptions>

<grid:SortColumnDescription ColumnName="Ca" SortDirection="Descending" />

</grid:SfDataGrid.SortColumnDescriptions>


<grid:SfDataGrid.Columns>

<grid:GridTextColumn HeaderText="Parametre" MappingName="Parametre" />


<grid:GridNumericColumn HeaderText="Fournis" MappingName="Fournis" TextAlignment="Right" FormatString="### ##0 ex." Width="90" />

<grid:GridNumericColumn HeaderText="Ventes" MappingName="Ventes" TextAlignment="Right" FormatString="### ##0 ex." Width="90" />

<grid:GridNumericColumn HeaderText="TxInv" MappingName="TxInv" TextAlignment="Right" FormatString="##0.# %" Width="90" />

<grid:GridNumericColumn HeaderText="CA" MappingName="Ca" TextAlignment="Right" FormatString="### ##0 €" Width="90" />


<grid:GridNumericColumn HeaderText="Fournis" MappingName="EvolFournis" TextAlignment="Right" FormatString="##0.# %" Width="80" />

<grid:GridNumericColumn HeaderText="Ventes" MappingName="EvolVentes" TextAlignment="Right" FormatString="##0.# %" Width="80" />

<grid:GridNumericColumn HeaderText="TxInv" MappingName="EvolTxInv" TextAlignment="Right" FormatString="##0.# pt" Width="80" />

<grid:GridNumericColumn HeaderText="CA " MappingName="EvolCa" TextAlignment="Right" FormatString="##0.# %" Width="80" />

</grid:SfDataGrid.Columns>


<grid:SfDataGrid.StackedHeaderRows>

<grid:StackedHeaderRow>

<grid:StackedHeaderRow.StackedColumns>

<grid:StackedColumn ChildColumns="Fournis,Ventes,TxInv,Ca" HeaderText="{Binding Source.DataContext.LibellePeriode, Source={StaticResource pageSource}}" />

<grid:StackedColumn ChildColumns="EvolFournis,EvolVentes,EvolTxInv,EvolCa" HeaderText="Evolutions (P-1)" />

</grid:StackedHeaderRow.StackedColumns>

</grid:StackedHeaderRow>

</grid:SfDataGrid.StackedHeaderRows>


</grid:SfDataGrid>

</Page>



Saravanan M [Syncfusion]
Replied On June 6, 2015 03:20 AM UTC

Hi Aurelien,
Thank you for contacting Syncfusion support,
We have analyzed your query and you could not update the HeaderText property  of StackedColumn directly. In your sample, you have created the separate instance of ViewModel as static resource for stacked column, hence it not updates the header text while changing the property at runtime. So we need to define the resource globally in App.XAML file and set it as DataContext to Window and use the same resource to StackedColumn to make it work. Please refer the below code snippet.
Codesnippet[App.XAML]:

<Application.Resources>

        <local:ViewModel x:Key="stackedHeader"/>
</Application.Resources>


Codesnippet[MainPage.XAML]:

<Page

    x:Class="SfDataGridDemo.MainPage"

    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"

    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

    xmlns:local="using:SfDataGridDemo"

    xmlns:syncfusion="using:Syncfusion.UI.Xaml.Grid"

    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"

    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d"
    DataContext="{StaticResource stackedHeader}">
.
.

<syncfusion:StackedHeaderRow.StackedColumns>

         <syncfusion:StackedColumn  ChildColumns="ProductId,ProductName"  HeaderText="{Binding StackedText,Source={StaticResource stackedHeader},Mode=TwoWay}"  />

        <syncfusion:StackedColumn ChildColumns="NoOfOrders,OrderDate" HeaderText="OrderDetails" />

         <syncfusion:StackedColumn ChildColumns="CountryName,ShipCity" HeaderText="ShipDetails" />

</syncfusion:StackedHeaderRow.StackedColumns>


We have prepared the sample based on your requirement and you can download it from following location,
Sample Location: SfDataGridSample
Please let us know if you have any other queries,
Regards,
Saravanan.M

Aurélien
Replied On June 18, 2015 03:49 PM UTC

Hi,
Thanks for your reply.
I've just forget to define mode with TwoWay value in the Binding parameter.

Best regards,
Aurelien

Saravanan M [Syncfusion]
Replied On June 19, 2015 01:55 PM UTC

 Hi Aurelien,

Thanks for your update. Please let us know if you need further assistance on this query.

Regards,

Saravanan.M


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;