Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
15
Column template changing at runtime when switching between tabs
posted

Hi,

XamDataGrid - version 19.2

There is a tab control that hosts a xamdatagrid with a lot of columns. Based on the tab in selection the related grid columns are made visible while setting visibility to false on the rest. This happens on the tab switching event. What is observed (see pic.) is that on switching from tab 3 to tab 1 the 2nd column 1st row has the correct contenttemplate and shows data while the 2nd row has an incorrect contenttemplate and so doesnt show the data. Note that the parent element's data context is not being propogated to the child. The child belongs to another column.

I was able to "workaround" this, strangely, by changing the order of the columns but we need to get to the cause.

Thanks

Reshma

Parents
  • 15
    Offline posted

    Hi Andrew,

    Thanks for looking into this. I've incorrectly submitted here, this is used on a  WPF app

    1. InfragisticsWPF.Controls.Grids.XamGrid.dll  19.02.20192.52 

    2. There is 1 grid that is being used by all tabs. In the XAML there is a tab control followed by the grid. The UI shows the impression of hosting the grid on the tab but its actually just 1 grid being reused by all tabs. Each tab is to show a certain set of columns on selection and hide the rest. The columns are bound to the grid using the datasource property. On the tab selection event the columns for the tab are made visible and rest are collapsed

    3. Yes the template is applied once for the 2 rows and is correctly set at the start. Switching between the tabs is causing the behavior where the cell content disappears. Only the visibility is being changed on the event

    4. We are setting the ContentTemplate on the CellValuePresenter as a xaml style.


    <Style x:Key="LeggerStyleCellTemplate" TargetType="{x:Type dataPresenter:CellValuePresenter}"

    <Setter Property="ContentTemplate">
    <Setter.Value>
    <DataTemplate>

    <Grid x:Name="Grid" Height="21">

    <ContentPresenter Content="{TemplateBinding Content}" HorizontalAlignment="{TemplateBinding HorizontalAlignment}" VerticalAlignment="Center" Visibility="{TemplateBinding Visibility}"/>

Reply Children
No Data