How to supress WPF tool tips? - wpf

Is there a way to supress WPF tool tips, other than by setting their content to null?
I am extending the Calendar control to provide date highlighting, using Charles Petzold's MSDN article as a guide. As per the article, I use a value converter to return a string if a date on in the Calendar was found in a date list. The string (number of appointments for the day, for example) is displayed as a tool tip when the mouse is over the date. If the date wasn't found in the list, the value converter returns null.
Overall, it's pretty cool, but I'd like to provide an option to turn the tool tips off and just show highlighting. I am already using a null value when a date is not found, so that a tooltip is not displayed for that date. The null value also supresses the highlighting for that date. So, I can't simply return a blanket null if tool tips are turned off, because it would turn off the highlighting, as well.
I tried creating the tool tip in a separate tag and giving it a name, so that I could use a data trigger to turn it on and off. No go-- a tool tip is considered a property, and while it will compile as a separate object, it throws a runtime exception.
I also tried returning a coded value, 'NOSHOW' if the date was not found in the date list, so that I could use null to supress tool tips. Unfortunately, that gives every unhighlighted date a tool tip that says NOSHOW.
So, at this point I am scratching my head. Any suggestions as to how I can get this done? Thanks for your help!

ToolTipService.IsEnabled=False
<TextBox ToolTipService.IsEnabled="False" />

Related

SQL Report Builder 3.0 - Failed to preview report

I have looked but have not been able to find another posted question that matches my scenario.
I am replicating a report from an old DB and rebuilding it using a new DB, so I'm simply copying the old report elements and pasting them into a new report template and modifying as needed. I've gotten to one part where the error I'm getting is as follows:
The Color expression for the text box ‘Textbox94’ refers to the field
‘Gallon_Qty’. Report item expressions can only refer to fields within
the current dataset scope or, if inside an aggregate, the specified
dataset scope. Letters in the names of fields must use the correct
case.
I have looked everywhere I could possibly think to look to see where this issue is hiding, but cannot find where this textbox is 'referring' to anything. Since it appears to be specific to this textbox, I presume it is specific to the text box properties of that text box, but it seems I'm mistaken. For added clarity, what I have checked includes every menu option within the text box properties (General, Number, Alignment, Font, Border, etc.) and every fx (function) button to ensure nothing was hiding (that's gotten me before). I have compared with another report element that works similarly and cannot find where the problem is. Any tips on where else I might check to uncover the root of this issue? Happy to provide screenshots if it will help, just let me know.
Side note: I can't thank you guys enough for all the help I've gotten on here!
I discovered where the issue was.
Text Box Properties>Font>Color>fx box
This is where the value was hiding. Hope this helps someone else.

DateTimePicker: Use neither calendar nor spin button

I want to take advantage of DateTimePicker's date validation, but the calendar seemed cumbersome to our customers for setting the date (they'd rather do it using just the keyboard, tabbing their way through the form).
So I took a long look at the documentation and found that one way to get rid of the calendar was setting the ShowUpDown property to true. So I got this:
However, our customers are now saying that they don't want to use the spin button, and therefore they don't want it to be visible/accesible. i.e. they want this:
However, if i set ShowUpDown to false, I'm back to the calendar. Is there another way?
Had to roll my own Custom Control. Luckily, some other guy from the team has already written custom controls so I have example code to get started. Anyway, what good is a framework if I have to do this kind of things myself? Hope they solved this in .net 4.5...
EDIT: Using a MaskedTextBox with ValidatingType = typeof(System.Date) is a better solution. Sorry .NET!

StringFormat in XAML, WPF : Currency Formatting

How can i obtain currency formatting according to my country i.e indian rupee, INR or Rs ??
Please tell me the way to achieve this ??
Right now when i use StringFormat="{}{0:C}", "$" is being used
I have gone through this link and i am able to achieve the desired result but i am worried about using this in my project. Is this code safe ??
What does this line mean in the above link "when you test functionality related to settings change it’s important you start the program directly from a folder window, if you run it from within Visual Studio or any other program you may get incorrect results."
You can specify the culture in your binding like this:
TextBlock Text="{Binding Value, StringFormat=C, ConverterCulture=nl-BE}"
nl-BE is belgian culture, you can exchange it with Indian culture info, I don't know that ;-)
Or you can set your current thread to the right culture, so you will use it everywhere in your application:
Thread.CurrentThread.CurrentUICulture = new CultureInfo("hi-IN");

Silverlight Date Formats

I'm getting some very strange date formatting issues in my Silverlight application. My local culture is set to UK, yet I am consistently seeing US dates popping up all over the place. I can easily hardcode these to UK format in specific loactions using:
<UserControl ... Language="en-GB"...>
But as I'm sure you'd all agree this is a terrible thing to do.
I have tried setting the Lanaguage to en-GB in the main application and this has partial success. I have also tried Justin Angels suggestion (posted here: How to change date format in Silverlight DatePicker control?), again only partial success.
An example of the issue can be seen here:
http://lh3.ggpht.com/%5FL9TmtwXFtew/Sw5aVZJfG1I/AAAAAAAAGkI/6jYnsB91HjI/image%5Fthumb%5B1%5D.png http://lh3.ggpht.com/%5FL9TmtwXFtew/Sw5aVZJfG1I/AAAAAAAAGkI/6jYnsB91HjI/image%5Fthumb%5B1%5D.png
The datagrid on the parent page shows UK formatting, whilst the information in the ChildWindow shows US formatting ...grrrr
Anyone have a definitive solution for solving this across a whole application?
Thanks,
Mark
You can data bind Language property of the root visual element. Take a look at my question here:
How to switch UI Culture of data binding on the fly in Silverlight
Can you not use the SelectedDateFormat property of the datepicker? If you want to do this once could you not create your own usercontrol that derives from the original with this value preset, then use your derived control throughout your app?
Kindness,
Dan
Shot in the dark, but does changing the browser's Language Preference make a differnence? I.e. in IE Tools-->Internet Options-->Languages.
HTH
Mark
You can set the date format for your entire application in the application start up event as follows.This will override any regional settings on the users machine
Thread.CurrentThread.CurrentCulture = (CultureInfo)Thread.CurrentThread.CurrentCulture.Clone();
Thread.CurrentThread.CurrentCulture.DateTimeFormat.ShortDatePattern = dd/MM/yyyy";

DateTimePicker Control in WPF

I am searching for a DateTimePicker control which can be used as a textbox so user can enter date/time data at will (ie; type in the string "11/09/2008 12:30:00") or can select date/time from a drop down list that contains a calendar/time box (what i meant is that this control can provide both options as mentioned). If you have found such a flexible control (and free too) please give me the needed information to obtain it.
There's the DatePicker and Calendar controls from the WPF team, but I don't believe they handle times (as in your example) - just dates. Worth a look though.
Have a look at this WPF Date Picker question.
Cheers
Telerik has a decent DateTimePicker control but it's not free.
Old question, but for anyone interested... Extended WPF Toolkit™ Community Edition is free (also has a premium option) and contains a DateTimePicker which I have found to be very useful in WPF!
I am not sure whether you don't want to use JQuery or not aware of it. But here is this free/open source date time picker from JQuery which does exactly what you are looking for, plus lot more.

Resources