Posted 3 years ago
by Yuki Ogawa
Version: 21.1.3
Platform: .NET 5.0
Environment: Windows 10 (64-bit)

I wanted to pass a null value to the RoundingDecimalPlace of the DoubleEditBox in ThemedDataGrid and wrote the following code, but the null is not set correctly.
<datagrid:ThemedDataGrid>
<datagrid:ThemedDataGrid.Columns>
<datagrideditors:DataGridDoubleColumn RoundingDecimalPlace="{x:Null}"/>
</datagrid:ThemedDataGrid.Columns>
</datagrid:ThemedDataGrid>
Expected: RoundingDecimalPlace is null
Actual: RoundingDecimalPlace is 8
Steps to Reproduce:
- Create new WPF project
- Edit the code as follows
*.csproj
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>WinExe</OutputType> <TargetFramework>net5.0-windows</TargetFramework> <Nullable>enable</Nullable> <UseWPF>true</UseWPF> </PropertyGroup> <ItemGroup> <PackageReference Include="ActiproSoftware.Controls.WPF.Editors.Interop.DataGrid" Version="21.1.3" /> <PackageReference Include="ActiproSoftware.Controls.WPF.DataGrid.Contrib" Version="21.1.3" /> </ItemGroup> </Project>
MainWindow.xaml
<Window x:Class="WpfApp31.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:datagrid="http://schemas.actiprosoftware.com/winfx/xaml/datagrid" xmlns:datagrideditors="http://schemas.actiprosoftware.com/winfx/xaml/datagrideditors" mc:Ignorable="d" Title="MainWindow" Height="450" Width="800"> <datagrid:ThemedDataGrid AutoGenerateColumns="False" ItemsSource="{Binding}"> <datagrid:ThemedDataGrid.Columns> <datagrideditors:DataGridDoubleColumn Width="*" Format="G" Header="Value" RoundingDecimalPlace="{x:Null}" Binding="{Binding Value}"/> </datagrid:ThemedDataGrid.Columns> </datagrid:ThemedDataGrid> </Window>
MainWindow.xaml.cs
namespace WpfApp31 { public partial class MainWindow : Window { public MainWindow() { InitializeComponent(); this.DataContext = new Data[] { new(0), new(1) }; } } public record Data(double Value); }
- Build and run
[Modified 3 years ago]