Description:
Use ReadMe sample in a new Blank Project.
<tv:TableView xmlns:tv="using:WinUI.TableView" x:Name="MyTableView" AutoGenerateColumns="False" ItemsSource="{x:Bind ViewModel.Items}">
<tv:TableView.Columns>
<tv:TableViewTextColumn Binding="{Binding Name}" Header="Name" />
<tv:TableViewNumberColumn Binding="{Binding Price}" Header="Price" />
<tv:TableViewTemplateColumn Header="Quantity">
<tv:TableViewTemplateColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding Quantity}" />
</DataTemplate>
</tv:TableViewTemplateColumn.CellTemplate>
<tv:TableViewTemplateColumn.EditingTemplate>
<DataTemplate>
<NumberBox Value="{Binding Quantity, Mode=TwoWay}" />
</DataTemplate>
</tv:TableViewTemplateColumn.EditingTemplate>
</tv:TableViewTemplateColumn>
</tv:TableView.Columns>
</tv:TableView>
public partial class MainViewModel
{
public ObservableCollection<Item> Items { get; set; }
public MainViewModel()
{
Items = new ObservableCollection<Item>
{
new Item { Name = "Item 1", Price = 10.0, Quantity = 1 },
new Item { Name = "Item 2", Price = 15.0, Quantity = 2 },
new Item { Name = "Item 3", Price = 20.0, Quantity = 3 },
// Add more items here
};
}
}
[GeneratedBindableCustomProperty]
public partial class Item : INotifyPropertyChanged
{
private string _name;
private double _price;
private int _quantity;
public string Name
{
get => _name;
set
{
_name = value;
OnPropertyChanged(nameof(Name));
}
}
public double Price
{
get => _price;
set
{
_price = value;
OnPropertyChanged(nameof(Price));
}
}
public int Quantity
{
get => _quantity;
set
{
_quantity = value;
OnPropertyChanged(nameof(Quantity));
}
}
private void OnPropertyChanged(string propertyName)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
public event PropertyChangedEventHandler PropertyChanged;
}
Steps to Reproduce:
Add following flags in csproj:
<IsAotCompatible>true</IsAotCompatible>
<WindowsPackageType>None</WindowsPackageType>
<WindowsAppSdkSelfContained>true</WindowsAppSdkSelfContained>
<TrimMode>partial</TrimMode>
<PublishAot>true</PublishAot>
<PublishReadyToRun>True</PublishReadyToRun>
<PublishTrimmed>True</PublishTrimmed>
if you run app with Visual Studio it is working fine:
but, right click on your project and select Publish, choose x64 and publish it.
now if you run published exe file, you will see this:
Expected behavior:
columns and data should be shown normally
Screenshots:
If applicable, add screenshots to help explain your problem.
Environment:
- Package Version: 1.4.1
- WinAppSDK Version: 2.2.0
Contribution:
Description:
Use ReadMe sample in a new Blank Project.
Steps to Reproduce:
Add following flags in csproj:
if you run app with Visual Studio it is working fine:
but, right click on your project and select Publish, choose x64 and publish it.
now if you run published exe file, you will see this:
Expected behavior:
columns and data should be shown normally
Screenshots:
If applicable, add screenshots to help explain your problem.
Environment:
Contribution: