Skip to content

Fixes datagrid warnings #6495

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,9 @@ object GetKey(object o)
if (key == null)
key = item;

if (_valueConverter != null)
key = _valueConverter.Convert(key, typeof(object), level, culture);
var valueConverter = ValueConverter;
if (valueConverter != null)
key = valueConverter.Convert(key, typeof(object), level, culture);

return key;
}
Expand All @@ -99,6 +100,8 @@ public override bool KeysMatch(object groupKey, object itemKey)
}
public override string PropertyName => _propertyPath;

public IValueConverter ValueConverter { get => _valueConverter; set => _valueConverter = value; }

private Type GetPropertyType(object o)
{
return o.GetType().GetNestedPropertyType(_propertyPath);
Expand Down
13 changes: 7 additions & 6 deletions src/Avalonia.Controls.DataGrid/Utils/CellEditBinding.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
using Avalonia.Data;
using Avalonia.Reactive;
using System;
using System.ComponentModel.DataAnnotations;
using System.Collections.Generic;
using System.Reactive.Subjects;
using System.Text;

namespace Avalonia.Controls.Utils
{
Expand Down Expand Up @@ -67,11 +65,14 @@ public SubjectWrapper(ISubject<object> bindingSourceSubject, CellEditBinding edi

private void SetSourceValue(object value)
{
_settingSourceValue = true;
if (!_settingSourceValue)
{
_settingSourceValue = true;

_sourceSubject.OnNext(value);
_sourceSubject.OnNext(value);

_settingSourceValue = false;
_settingSourceValue = false;
}
}
private void SetControlValue(object value)
{
Expand Down Expand Up @@ -157,4 +158,4 @@ public void CommitEdit()
}
}
}
}
}