stringformat

WPF - HeaderStringFormat Doesn't work in Expander

I can't seem to find the magic combination to make the HeaderStringFormat work for a WPF Expander. Here are all the things I've tried: <Expander Header="{Binding Path=MyProperty, StringFormat=Stuff: ({0})}" > <TextBlock Text="Some Content" /> </Expander> <Expander HeaderStringFormat="{}Stuff ({0})" Header="{Binding Path=MyProperty...

How to use StringFormat in XAML elements?

I'm deep in a XAML stack of elements binding to orders. The order date displays as e.g. "12/31/2008 12:00:00 AM". I want it to display as e.g. "31.12.2008". How can I do this? I have seen other stackoverflow questions mention StringFormat but they use multibinding in ways that I can't get to work. Here is the kind of syntax I would l...

WPF ListView Thousand Separator

I want to display numbers i thousand separated format. Numbers are displayed in a Column of ListView control. I've the following xaml code, but it doesn't even compile! <GridViewColumn Header="Total" DisplayMemberBinding="{Binding PaidValue, StringFormat={0:0,0}}" /> From my c# point of view, {0:0,0} is a correct format to do thi...

Conversion of text data into date

I have a situation in which I need to convert a text data into date. I have used the following code to do so! string s = textBox1.Text; if (String.IsNullOrEmpty(s)) { textBox2.Text = "Please enter any date."; } else { DateTime dt = DateTime.Parse(s); ...

Javascript: why does this produce and ugly string??? I would like currency

var total = 0; $(".amount").each(function() { var value = $(this).val(); value = (value.length < 1) ? 0 : value; var tmp = parseFloat(value).toFixed(2); total += tmp; }); $(".total").text(total); I am trying to loop through some text boxes and sum up their values....

"Input string was not in a correct format" when using SqlDataReader and Label

I'm joining two tables - Contact and RetailTrainingUserLevelMap in a Select statement. (The common column in both is the RetailTrainingUserLevelID int) SELECT Contact.IntranetUserName, Contact.CompanyName, RetailTrainingUserLevelMap.RetailTrainingUserLevel FROM Contact INNER JOIN RetailTrainingUserLevelMap ON Contact.RetailTrainingU...

String.Format value in App.config is producing an extra backslash

Here's the line from App.Config: <add key="CheckFileFormatString" value="P{0}\t&quot;{1}, {2}&quot;\t{3}\t{4}\t{5}\t{6}\t{7}\t{8}\t{9}\t{10}"/> Here's the code that puts it into a string (please ignore the deprecated .AppSettings.Get call, unless that's the problem): string format = ConfigurationSettings.AppSettings.Get("CheckFileFor...

RegEx for String.Format

Hiho everyone! :) I have an application, in which the user can insert a string into a textbox, which will be used for a String.Format output later. So the user's input must have a certain format: I would like to replace exactly one placeholder, so the string should be of a form like this: "Text{0}Text". So it has to contain at least on...

What's the shorter xaml syntax for Multibinding using StringFormat with multiple bindings?

Hi for a single binding, we use: <TextBlock> <TextBlock.Text> <MultiBinding StringFormat="{}{0}"> <Binding Path=EmployeeName/> </MultiBinding> </TextBlock.Text> </TextBlock> or a shorter syntax: <TextBlock Text="{MultiBinding StringFormat=\{0\}, Bindings={Binding Path=EmployeeName}}"/> Now, if you have multibi...

WPF Data Binding with StringFormat when UpdateSourceTrigger is PropertyChanged

I want to have a textbox append a specific string once the user tabs out of the control, i.e. LostFocus, however I prefer the textbox to validate as the user types, so UpdateSourceTrigger is set to PropertyChanged. Is there a way to get this to work in WPF? Looked at this question which is similar but wondering if there is a cleaner ...

Wpf Binding Stringformat to show only first character

Hi, Is there any way so that i can show only first character of a Bound string on a textblock..? For eg;If i Bind 'Male', my textblock should only show 'M'..... ...

StringFormat flags : display the whole line

the StringFormat flags permits to differently represent a string in a rectangle. in this example was used string_format.FormatFlags = StringFormatFlags.NoClip one: Question having txt = "The quick brown fox jumps over the lazy dog." can I represent this text entirely as a single line (non-clipped and centered). I mean, I use ...

Actionscript 3.0 String With Format?

How can i format a string with supplied variables in AS3? //vars var myNumber:Number = 12; var myString:String = "Months"; var myObject:MovieClip = year; //string myString.txt = "One (?) consists of (?) consecutive (?)", string(myObject), string(myNumber), myString; so in the string above, i would like myString to display "One year c...

Asp.net 3.5 ListBox DataTextFormatString value to convert the string data to TitleCase

I have a webform with a ListBox control bind to a DataTable with a string column mapped(bound) to dataText field. This column retruns a string in all lowercase. I want to display the string in title case(sometimes uppercase) what value should I assign to DataTextFormatString field to get this functionality? Is there any better way of do...

String format or REGEX.

I need an simple way to check whether a string that is sent to my function is of the form: (x + n)(x + m) //the +'s can be minus' //n and m represent a double //x represents the char 'x' Is there a simple string format that I can use to check that this is the form. As opposed to checking each character singularly. The whitespace wil...

QString::number() - zero padding?

I want to "stringify" a number and keep leading zeros. Unlike this question: http://stackoverflow.com/questions/885401/print-trailing-zeros-in-a-qstring I also need this in hex. By code now uses this, which is not enough: QString::number(myNumber,16).toUpper() ...

WPF XAML StringFormat: Culture Workaround broken in C# 4.0?

The work around... FrameworkElement.LanguageProperty.OverrideMetadata( typeof(FrameworkElement), new FrameworkPropertyMetadata( XmlLanguage.GetLanguage(CultureInfo.CurrentCulture.IetfLanguageTag))); ...used to work till now (mentioned here: http://stackoverflow.com/questions/520115/stringfomat-localization-problem/520334#520334)....

WPF StringFormat={0:C} showing as dollars

Why does this line of code <TextBlock Text="{Binding Net, StringFormat=c}"/> Output the result as $xx.xx when all my regional settings are set to UK. I expect it to output it as £xx.xx. Any ideas? I have tried different variations of the stringformat including StringFormat={}{0:C} but still get the same result. Thanks for looking. ...

C# Double.ToString()

Possible Duplicate: Custom numeric format string to always display the sign To format a double to certain precision in C# I write this: d.ToString("#0.00"); What if I want to force a the sign to appear.. e.g +2.54 and -2.54 ...

javascript error of unterminated string

I want pass a parameter of javascript functiona which is a string. This javascript function is a hintbox on mousehover.. and the string i am using is like this: Hemmed Finish: Every side/edge (1/2" to 2") of the banner are folded and glued (special vinyl solution) or heat pressed. This is the most common and best finish opt...