Silverlight validation - Automatically show validation message - silverlight

I finally got validation working with MVVM in my Silverlight app. Now I'm wondering if there is a way to show the validation message that pops up to the right automatically without having to first click inside the textbox. The red border shows up, but it would be nice if the message was there as well. Any ideas?

You can edit the textbox's template to change how / where validation errors are shown. The default textbox template has them in a tooltip, you could, for instance move that to a label or textblock.

For an example of how to conveniently show it in a tooltip, check my blog post: Taking data binding, validation and MVVM to the next level - part 1

Related

wpf data validation control template - Not getting reflected when used on multiple pages

I am trying to use wpf data validation as shown in link below.
In WPF, How to display validation error in TextBox like the image below?
The problem that I am facing is, I have a Title text box on first and last page of my application.
For both the pages viewmodel used is same and both the controls are bound to same property. I applied control template to both of them as shown, but somehow that validation part gets applied to only first text box, when I go to last page I cannot see the error on validation. It is default textbox without any validation shown on it. My validation is simple textbox empty validation.
Also when I comeback from last page to first page my control template validation is gone from first page also.
Textbox that I am using is from WPF.Extended.Toolkit.dll (WatermarkTextBox)
Any idea what could be the reason?
try to wrap your textbox or the container with your textbox in a AdornerDecorator element.
<UserControl>
<AdornerDecorator>
<Grid>
<TextBox/>
</Grid>
</AdornerDecorator>
</UserControl>

Editing Button Design

I customized the design of a button in WPF but when I hover over the button it shows the default design of the button.
This also happens to combo boxes.
That sounds like you just changed things by setting various appearance related properties, but to fully customize the button you need to change the Template. See this page for an example style (and this question if you need to get the default tenmplate of it)

Validation Error Temple does not seem at first time

I write simple Validation code for wpf . There is text box . If I enter invalid value or textbox is empty then Validation Error Temple appears on windows. This is okay. It works very well.
But I use this code another project. I use ribbon menu. When I clicked ribbon button in ribbon menu, My page is navigated in frame but Validation Error temple does not seem at page. If a enter a value and then delete then Temple appears. I don't Understand. What does same code behave
Your validation code is getting triggered when property text of your text box get changed. Some how on frame navigation property changed event is not firing on page load event. I will be able to help more if you provide your validation logic and the way you are binding the text box.

In my Windows Phone app,I want to turn my current page unable in gray and show a textbox in foreground

Like the title said,how may i turn the grid(or page) and the components in it into background gray and unable and show a new component in foreground.
It's a common effect in the web page,but i cannot do that with a xaml.
Please answer in detail better with sample code if you do.Thanks in advance.
Here's an example of using a Popup to display a UserControl when a Page is navigated to. The OnNavigatedTo function creates a popup, binds a Click event to the UserControl, and then shows the UserControl over the entire page. If the correct password is entered, ("password" in the example) the control disappears. You'll need to modify it for your own requirements, but it should definitely get you started.
https://skydrive.live.com/redir.aspx?cid=ef08824b672fb5d8&resid=EF08824B672FB5D8!343
You'll want to use the VisualStateManager and create some animation transitions to switch between the old and new components. I won't paste the code here for brevity, but if you check out:
http://visualstudiomagazine.com/articles/2011/07/22/wcmob_visual-states.aspx
You'll see a simple example of switching between two UI components on a single page within a Windows Phone 7 PhoneApplicationPage. In your scenario, you'd use this paradigm to create 2 animation storyboards, one for showing an overlay control and one for settings the 'disabled' property on the main grid.

WPF menu like control showing when clicking a control ;) How?

I have an application that connects to a server. In the status bar I show the connection status, and on a click I want to open a "menu like" subcontrol over the status showing control where more detailed connection information is shown (like: user name, server name, ping delay, disconnect / reconnect button).
This should basically look like an inverse menu - and when the user clicks outside of that area, the outside click should be suppressed (not triggering anything), but the detail info box should disappear.
I am a little at a loss here - first time I am to do something like that in WPF.
Which control would be advisable as base here? So far I have a custom control for the status bar - but basically it renders as a text box. Note tha the popup is not a menu - it should show a detailed view of the control, so I do not think I can reuse any existing control.
any Hints how to accomplish this?
Thanks in advance.
Two controls to look into:
1. Expander (this could work, but be carefull, it can shift your other controls
2. Button with template. Make a controltemplate for a button that includes a Popup item. This item can then be bound to a set of triggers/events in the button or in the wider form. I hope this helps :)

Resources