question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Stringformat - Display as hex not working

See original GitHub issue

No matter what I try, I cannot get an int/long/ulong value to show as hex decimal in Avalonia:

<DataGridTextColumn Binding="{Binding Value, StringFormat={}{0:x}}" Header="Abc" />
<DataGridTextColumn Binding="{Binding Value, StringFormat='{}{0:x}'}" Header="Abc" />
<DataGridTextColumn Binding="{Binding Value, StringFormat='{0:x}'}" Header="Abc" />
<DataGridTextColumn Binding="{Binding Value, StringFormat='\{0:x\}'}" Header="Abc" />
<DataGridTextColumn Binding="{Binding Value, StringFormat=X}" Header="Abc" />

What am I doing wrong?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
MihaMarkiccommented, Apr 19, 2021

@Symbai I suggest you to create a simple repro.

0reactions
maxkatz6commented, Apr 18, 2021

@Symbai just checked in control catalog:

<DataGridTextColumn Header="Population" Binding="{Binding Population, StringFormat={}{0:x}}" Width="3*" />

Works fine: image

What am I doing wrong?

Read more comments on GitHub >

github_iconTop Results From Across the Web

c# - String.Format for Hex
It looks like you want to send the data to some HTML CSS renderer (because of the #HEX format). Actually CSS wants you...
Read more >
Standard numeric format strings
In this article, learn to use standard numeric format strings to format common numeric types into text representations in .NET.
Read more >
C# Hexadecimal ("X") Format Specifier
The hexadecimal ("X") format specifier is used to convert a number to a string of hexadecimal digits. Set the case of the format...
Read more >
How to use the new FormatStyle to format an Int to hex?
The new FormatStyle let n = 0xdeadface print("n =", n.formatted(.number.how-to-do-upper-case-hex)) // I want: n = 0xDEADFACE // same as ...
Read more >
sprintf - Manual
Returns a string produced according to the formatting string format . ... x, The argument is treated as an integer and presented as...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found