Questions tagged [valueconverter]

Value converters are culture-aware. Both the Convert and ConvertBack methods have a culture parameter that indicates the cultural information.

Value converters are culture-aware. Both the Convert and ConvertBack methods have a culture parameter that indicates the cultural information.

Ref: IValueConverter

216 questions
47
votes
6 answers

WPF ValueConverter - Standard return for unconvertible value

Over the course of the last year or so I have seen many different value converters for many different purposes, from many different authors. One thing that sticks out in my mind is the wide variance of the 'default' values that are returned by…
A.R.
  • 15,405
  • 19
  • 77
  • 123
42
votes
7 answers

How to convert any Object to String?

Here is my code: for (String toEmail : toEmailList) { Log.i("GMail","toEmail: "+toEmail); emailMessage.addRecipient(Message.RecipientType.TO, new InternetAddress(toEmail)); } Please give me some suggestion about this.
Hemant Koli
  • 461
  • 1
  • 4
  • 4
25
votes
5 answers

Convert binary string to binary or decimal value

Is there any function to convert binary string into binary or decimal value? If I have a binary string 000101, what should I do to convert it into 5?
LifeWorks
  • 396
  • 1
  • 4
  • 12
24
votes
6 answers

Scaling between two number ranges

I remember using an equation to do this at some point – how do you do this in Javascript? Plugin two number ranges: rangeX = 1 (through) 10; rangeY = 300.77 (through) 559.22; Input a value in the rangeY scale: inputY = 328.17; Convert to…
alyx
  • 2,593
  • 6
  • 39
  • 64
18
votes
2 answers

Hex to int C# with VERY big numbers

I have a 256 chars long string that contains a hex…
Fredefl
  • 1,391
  • 2
  • 17
  • 33
16
votes
2 answers

Unable to find enum type for static reference in WPF

I'm trying to bind an enum to a radio button in WPF (Inspired by this answer), but I have trouble finding the enum type for the converter parameter: The enum is defined in the following way namespace Application.Models { public class Enums …
Christian Studer
  • 24,947
  • 6
  • 46
  • 71
13
votes
5 answers

Using resources as conversion results in a bind converter

When I try to bind a valueconverter from a defined enum Status to brush, I get an error in my XAML designer: 'OKStatus' resource not found. The application works fine runtime, but I'm not able to see my GUI in the designer. My resources are defined…
lewi
  • 477
  • 1
  • 5
  • 18
12
votes
1 answer

How can I display array elements in a WPF DataGrid?

I'm trying to display a series of rows in a WPF DataGrid where each row contains an array of booleans (the number of which is the same for all rows, it's not a jagged 2D array) that I want to display as individual columns, eg. Name | Day…
Cygon
  • 9,444
  • 8
  • 42
  • 50
11
votes
4 answers

Convert hex str to decimal value in delphi

I've got a problem to convert a string representation of an hex value in integer value with Delphi. for example: $FC75B6A9D025CB16 give me 802829546 when i use the function: Abs(StrToInt64('$FC75B6A9D025CB16')) but if i use the calc program from…
Simon Mardiné
  • 510
  • 2
  • 7
  • 23
10
votes
0 answers

Entity Framework Linq query is client-evaluated when using custom type with ValueConverter

I'm working with Microsoft's Entity Framework Core and tried to utilize ValueConverters to allow for custom types in my database model entities. The point is to have my own type which I can customize and which shields the rest of the code from a…
Kabuto5CZ
  • 303
  • 2
  • 10
10
votes
3 answers

how can I convert wstring to u16string?

I want to convert wstring to u16string in C++. I can convert wstring to string, or reverse. But I don't know how convert to u16string. u16string CTextConverter::convertWstring2U16(wstring str) { int iSize; u16string szDest[256] =…
D.A.KANG
  • 265
  • 2
  • 4
  • 12
10
votes
1 answer

WPF Richtextbox Bindable in .net 4.5

So I'm trying to use David Veeneman's Bindable WPF RichTextBox here in my .net 4.5 project. After adding the control and the ValueConverter in my code I noticed only the the public object Convert() will be triggered but the public object…
9
votes
6 answers

Double to string with mandatory decimal point

This is probably dumb but it's giving me a hard time. I need to convert/format a double to string with a mandatory decimal point. 1 => 1.0 0.2423423 => 0.2423423 0.1 => 0.1 1234 => 1234.0 Basically, I want to output all decimals…
wpfwannabe
  • 14,587
  • 16
  • 78
  • 129
8
votes
1 answer

How do you apply a ValueConverter to a convention-based Caliburn.Micro binding?

How do you apply a ValueConverter to a convention-based Caliburn.Micro binding? or do you need to use the {Binding} syntax? I know I could do this but how do I apply that custom…
kiwipom
  • 7,639
  • 37
  • 37
1
2 3
14 15