Skip to content
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

DataGridBooleanColumn shows X for false, should show empty box instead #297

Open
AdamSzofran opened this issue Jul 16, 2018 · 3 comments
Open

Comments

@AdamSzofran
Copy link

AdamSzofran commented Jul 16, 2018

The DataGridBooleanColumn shows a box filled with an X (Unicode character U+2612, Ballot Box With X) for false values. In my opinion this is incorrect. I believe it should show an empty box (Unicode character U+2610, Ballot Box) instead.

@AdamSzofran
Copy link
Author

It would seem this is the culprit (line 15 of DataGridBooleanColumn.cs):

    public class DataGridBooleanColumn : DataGridTextColumn
    {
        private const string UncheckedGlyph = "\u2612";

Instead, I believe the value of UncheckedGlyph should be "\u2610" instead.

@APopatanasov
Copy link
Collaborator

Hi @AdamSzofran ,

Changing the UI is consider as a breaking change and some people that expect to have "\u2612" as visual representation may complain if we decide to change it.

What I believe here will be the best solution is to introduce dependency properties for the checked/unchecked glyph and that way people will be able to set them as desired.

If you are interested on working on this feature simply you need to add the mentioned above properties in the DataGridBooleanColumn, make them work when they are changed at runtime and make a pull request. After that I will review it and if everything looks fine I will merge it.

Please, let me know if you have any additional questions.

@AdamSzofran
Copy link
Author

Hi @APopatanasov,

Thanks for suggesting the correct way to fix this. I may give it a try. For now, I was able to get my preferred unchecked glyph to display using this awful hack and referencing it from my Xaml:

using Windows.UI.Xaml.Controls;
using Telerik.UI.Xaml.Controls.Grid;

public class MyDataGridBooleanColumn : DataGridBooleanColumn
{
    private const string DefaultUncheckedGlyph = "\u2612";
    private const string MyUncheckedGlyph = "\u2610";

    public override void PrepareCell(object container, object value, object item)
    {
        base.PrepareCell(container, value, item);

        var textBlock = container as TextBlock;
        if (textBlock != null && textBlock.Text.Equals(DefaultUncheckedGlyph))
        {
            textBlock.Text = MyUncheckedGlyph;
        }
    }
}

I promise I won't submit a pull request for anything like that. 😄

Thanks,
Adam

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants