psavolai

What's going on
Visual studio keeps telling me that that My AdornedElementPlcaholder should be part of a template,
BUT IT IS !

What's really funny is that I managed to test this thing last friday, but today no way

Here's a fragment of my app.xml

<Application x:Class="App"xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"StartupUri="LoginDialog.xaml">

<Application.Resources>
<
ResourceDictionary>

<ControlTemplate x:Key="TextBoxError">
<
DockPanel LastChildFill="True">
<
TextBlock DockPanel.Dock="Right" Foreground="Red"FontSize="12pt" ToolTip="{Binding ElementName=MyAdorner, Path=AdornedElement.(Validation.Errors)[0].ErrorContent}">!!</TextBlock>

<Border BorderBrush="Red" BorderThickness="1">
<
AdornedElementPlaceholder Name="MyAdorner"/>
</
Border>
</
DockPanel>
</
ControlTemplate>

..... and so on

Any ideas

Petri.



Re: Windows Presentation Foundation (WPF) Can only use AdornedElementPlaceholder as part of Template ?

Nick Thuesen

I copy and pasted your ControlTemplate to a test app's resources and then referenced a TextBox's Template to it and it worked fine. I got a text box with a red border and two !! outside of the box. The only trouble I had was in your xaml Foreground="Red"FontSize="12pt" needed a space between the two properties. That was probably a by-product of your copy and paste to the forum though.


Did you try cleaning your solution and rebuilding





Re: Windows Presentation Foundation (WPF) Can only use AdornedElementPlaceholder as part of Template ?

psavolai

Thanks Nick.

Funnily enough it started working (again) after a cleaning operation and rebuild.
The Editor still complains about the AdornedElementPlaceholder (underlines it and shows a tooltip), but who cares as long it works !

Petri