akgulebubekir / Maui.DataGrid

DataGrid component for Maui
MIT License
231 stars 43 forks source link

Windows release mode custom CellTemplate display blank or not visible #187

Open Strypper opened 3 weeks ago

Strypper commented 3 weeks ago

Describe the bug When using the application in DEBUG mode everything display fine image

When i switch to release mode this what I got from the same data grid image

Code

<DataTemplate x:Key="DataGridItemColumnTemplate">
   <Label Text="{x:Binding}" 
          TextColor="Black" 
          VerticalOptions="Center" 
          HorizontalOptions="Center"/>
</DataTemplate>

<datagird:DataGrid ItemsSource="{x:Binding ControlGroupList}" 
                   SelectedItem="{x:Binding SelectedControl}"
                   IsRefreshing="{x:Binding IsRefreshing}"
                   RowHeight="80" 
                   HeaderHeight="50"
                   HeaderBackground="#35abc3"
                   BorderColor="Gray">
   <datagird:DataGrid.Columns>
       <datagird:DataGridColumn Title="Control" 
                                PropertyName="ControlIcon" 
                                Width="80" 
                                SortingEnabled="True">
           <datagird:DataGridColumn.CellTemplate>
               <DataTemplate>
                   <Frame BackgroundColor="#35abc3"
                          BorderColor="Transparent"
                          HeightRequest="60"
                          WidthRequest="60"
                          VerticalOptions="Center" 
                          HorizontalOptions="Center">
                       <Image Source="{x:Binding}" 
                              VerticalOptions="CenterAndExpand" 
                              HorizontalOptions="CenterAndExpand"/>
                   </Frame>
               </DataTemplate>
           </datagird:DataGridColumn.CellTemplate>
       </datagird:DataGridColumn>
       <datagird:DataGridColumn Title="Name" 
                                PropertyName="ControlName" 
                                Width="140" 
                                SortingEnabled="True"
                                CellTemplate="{x:StaticResource DataGridItemColumnTemplate}"/>
       <datagird:DataGridColumn Title="Type" 
                                PropertyName="CardType" 
                                Width="120" 
                                SortingEnabled="True">
           <datagird:DataGridColumn.CellTemplate>
               <DataTemplate>
                   <Frame BackgroundColor="ForestGreen"
                          BorderColor="LightGreen"
                          VerticalOptions="Center" 
                          HorizontalOptions="Center">
                       <Label Text="{x:Binding}" 
                              VerticalOptions="Center" 
                              HorizontalOptions="Center"/>
                   </Frame>
               </DataTemplate>
           </datagird:DataGridColumn.CellTemplate>
       </datagird:DataGridColumn>
       <datagird:DataGridColumn Title="Detail" 
                                PropertyName="ControlDetail" 
                                Width="650" 
                                SortingEnabled="True"
                                CellTemplate="{x:StaticResource DataGridItemColumnTemplate}"/>
   </datagird:DataGrid.Columns>
</datagird:DataGrid>

To Reproduce

  1. Use custom cell template
  2. Choose RELEASE MODE
  3. Deploy on Windows

Expected behavior Content must be shown

Screenshots If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

crwsolutions commented 1 week ago

I Played around with the grid today. Nice job! But I also have this phenomenon. I tried some older 4.0x and 3.0 version but they all had the same issue. I also played around with optimization, maybe something is compiled out, but that didn't help. Some kind of timing thing? Or maybe something .Net maui introduced?

daniol commented 1 week ago

Same issue. Debug build is fine, but the Release build has this problem. Only columns with CellTemplate are affected. I am using .NET 8, latest MAUI release version.