I've created a textbox style to contain a validation.errortemplate for use in a UserControl class. If the UserControl is loaded in the normal, non-MAF way, I can see the validation rule kicking in and getting visual feedback (thick red border, a circular bang to the right of the textbox, and an error message-in-a-tooltip) -- everything works the way I expect it to.
However... if I load that same UserControl in as an AddIn, I lose the visuals. (I do see the error tooltip behaving correctly, so I know my validation rule is firing; I just don't see the border and bang symbol.
My AddIn, by the way, is based on MSDN's example for an 'addin-which-provides-a-usercontrol.'
I know a few of the limitations of an AddIn (e.g., video won't play in an AddIn UserControl); is this another limitation, or am I screwing up?
Thanks in advance!
[Update -- I removed the error template from my UserControl.Resources -- as I suspected, in the non-MAF version, this causes the validation failure to result in the 'standard,' thin red border around the textbox. However, no such red border shows up in the MAF version. Ergo, the TextBox.Style seems to have been ruled out as the culprit.]
Got it working by enclosing the fields I want to validate within an AdornerDecorator tag... go figure :-)
Related
I want to define a grid style in the app.xaml, including the background color.
However, setting the color there, makes the whole content instantly invisible.
When application is executed, the following appears:
For a short moment, the button is visible.
How do I prevent this from happening, keeping in mind, that I wish a global background color for grids.
You can use a global style for the Grid as you have done it.
The issue you have faced comes from Visual Studio. So the issue is only present, if you start the application via Visual Studio.
To give the possibility for live tracking of UI-Elements the VS seems to add an AdornerLayerWindow, which, I suppose, also uses a Grid, which you see. You can find this window in Application.Current.Windows.
To get rid of this behaviour you have to deactivate option Options->Debugging->UI-Tools for XAML activate
I have an application that should work a bit like a message board: text gets parsed, hyperlinks are made "live" and displayed. Only it's in Silverlight. Because of that, I can't use TextBlock like they do here WPF - Making hyperlinks clickable, somehow it's different in Silverlight and it's not possible to do a Hyperlink with a Run inside it.
I've tried the RichTextBlock, as it says here Wrapping Text and Hyperlinks in Silverlight, but couldn't for the life of me figure out how to create the paragraphs and hyperlinks from code, since I need to populate it dynamically.
Then I thought I'd settle for a less elegant solution involving TextBlocks and HyperlinkButtons in a WrapPanel. I added a namespace reference, like it says here WrapPanel in Silverlight 4 toolkit, but when I reference it in XAML, there's no WrapPanel in it, only DataField, DataForm and VisualStateManager.
This Text areas and hyperlinks? doesn't work either, the Silverlight RichTextBox is different and LinkLabel is missing.
Maybe there's another solution that I don't know? I'm keeping an open mind. Any help appreciated.
Silverlight Intelliscence in VS 2010 does not recognize new controls on page.
Solution needs built for the intelliscense to recognized the newly placed control (textbox label extra)
Is this a BUG?
Edit: controls are not custom, they are siple label and textbox and button controls.
Edit:
button from toolbox dragged to designer,
switched to home.xml.cs
types button1
error, intelliscence doesnot recognize the button1 added.
must build each time.
what is the solution to this problem
Its not bug, its feature. Custom controls must be compiled before you can use it.
The intellsense shows what is available to source code at the time of editing. Source code has no real access to the Xaml. What you see from the Xaml in intellisense is actually in YourUserControl.g.i.cs file, which is an auto generated from the Xaml. You can see this file by selecting "Go To Definition" from the context menu of the InitialiseComponent method.
There is often a delay between the edit of the Xaml and the re-generation of this file, at times it never updates. However saving the Xaml always regenerates the file. I've become accustomed to always save the Xaml file before editing code-behind to ensure the intelisense is up to date.
Is there a way to remove the annoying grid lines in the design view of Visual Studio 2010? Or at least style them to fade them off?
I'm not referring to the Grid component, but to the design view in WPF which draws visual lines over and around every components, making screens look like a soup in design view.
In Blend, if you disable Show Handles (in View > Show Handles, or F9), you can turn off those stupid blue lines.
Pretty sure you can derive from Grid and build design-time meta-data assembly with it as described on this msdn blog:
http://blogs.msdn.com/b/wpfsldesigner/archive/2010/01/13/wpf-silverlight-design-time-code-sharing-part-i.aspx#required
The reason I suggest deriving from Grid is because you want the designer to load new meta data for the type. Hopefully this implementation will override default behaviour although I have not tried myself.
Can I ask why you want to make this change? I am interested.
You say not the Grid component but those blue lines are part of the Grid control and you can simple drag them off the screen to remove them. I do not see any other light blue lines in that first link. If the problem is when you are running the app then uncheck the 'show gridlines' property for the Grid in VS2010.
I have a WPF user control which needs to validate some fields. It is bound to a class implementing IDataErrorInfo.
When I set the user control as the content of my ContentPresenter in another, already open, window, I can see validation occurring, and error messages being returned, however, I don't get any validation adorner - e.g. the default red outline.
If I enter the field and leave it (triggering re-validation) the validation adorner appears.
Also, if I show the user control in it's own window it shows the validation adorner immediately.
(I'm using Caliburn IResults to do this underneath, e.g. Show.Dialog<VM>(); but I suspect this isn't related)
Can anyone offer any suggestion why the validation adorners aren't appearing immediately. (I had guessed animation on my ContentPresenter ContentChanged, however, I have removed this and still experience the problem.
thanks,
Chris
This is a known bug that exists in .NET 3.5. You may be able to implement a workaround, however if it is feasible, I would recommend upgrading to .NET 4 as this will take care of your issue with validation.