Styling Issues - Designer Errors
Sometimes, when I try to write styling xaml code, I get an error from the designer on TargetType attribute:
<
Stylex:Key="{x:Type ListBoxItem}"TargetType="{x:Type ListBoxItem}">which says that the value is not of a desired type:
Error 1 Object of type 'System.Windows.Markup.TypeExtension' cannot be converted to type 'System.Type'.
And one more question:
When creating a gradient background in Sparkle, it adds additional <GradientStopCollection> under for example <LinearGradientBrush.GradientStops> tags which "Cider" warns it's incorrect, what's that again?
Are these questions stupid? I dont care actually, I need the answers anyway.
[1242 byte] By [
assadgh] at [2008-2-11]
Not sure about the TargetType problem.
Can you try to figure out some cases that work and some that don't and post details.
Ideally, EID ("Sparkle") would not be creating a GradientStopCollection, as it is not necessary.
The XamlPresentation2006.xsd that drives xaml intellisense in "Orcas" is what is actually providing those warnings, I believe.
It is doing that because I built that schema to recommend minimal markup.
1) It will recommend not having a Property Element <DockPanel.Children> since DockPanel already defaults all content inside of it to the Children property (see ContentPropertyAttribute).
Avoiding Property Elements for Content Property
While this works, it isn't minimal:
<DockPanel>
<DockPanel.Children>
<Button />
<Button />
</DockPanel.Children>
</DockPanel>
This works and is minimal
<DockPanel>
<Button />
<Button />
</DockPanel>
2) It will recommend not providing an explicit collection Object Element as it is not minimal...
While this works, it isn't minimal:
<LinearGradientBrush>
<LinearGradientBrush.GradientStops>
<GradientStopCollection>
<GradientStop ... />
<GradientStop ... />
<GradientStop ... />
</GradientStopCollection>
</LinearGradientBrush.GradientStops>
</LinearGradientBrush>
For Feb 2006 CTP, this is minimal (I believe):
<LinearGradientBrush>
<LinearGradientBrush.GradientStops>
<GradientStop ... />
<GradientStop ... />
<GradientStop ... />
</LinearGradientBrush.GradientStops>
</LinearGradientBrush>
Next CTP, this should work too: (LGB will have a ContentPropertyAttribute like this: [ContentProperty("GradientStops")]
<LinearGradientBrush>
<GradientStop ... />
<GradientStop ... />
<GradientStop ... />
</LinearGradientBrush>
I'll make sure to contact the EID team to understand where their next CTP will be with regard to this issue.
Thx, Rob Relyea
WPF, PM
http://longhornblogs.com/rrelyea
One thing to add...using XSD for intellisense here is a short term solution. I hope to see an improved intellisense system to replace it.
XAML intellisense powered by XSD has major limitations...
Cross your fingers...
Thank you Rob for your detail explanation on current Schema violation between Cider and Sparkle.
About the property type errors, I can just say that, this error always occurs and Cider opens the file in XAML view.
*Do we have WinFX-Windows SDK-Orcas-Sparkle builds to work on Vista Build 5365?
Your welcome.
For the property type errors, does this ever fail compilation, or does it just fail while running in the cider designer?
No, there is no release of those tools since Feb CTP. Next CTP will have a matching set. Sorry.
-Rob Relyea
WPF, PM
http://longhornblogs.com/rrelyea