index > WPF Designer ("Cider") > Binding sample causes error in VS

Binding sample causes error in VS


Just FYI

Steps:

Extract and Build - Binding to a Non-Text Property Sample

NickNotYet

This is an example of a known load limitation. This is documented here: http://channel9.msdn.com/wiki/default.aspx/Cider.MayCTPXAMLLoadLimitations

Specifically, have a look at: http://channel9.msdn.com/wiki/default.aspx/Cider.MayCTPProjectLimitations, in project types are not yet supported in Cider.

Sorry for the inconvenience.




Jim Nakashima, Microsoft. (This post is provided "as-is")
Jim Nakashima - MSFT

Ok, so I checked out the limitations stuff, but the workaround itslef doesn't compile.

this

xmlns:cider="clr-namespace:SliderAdornerLib;assembly=SliderAdornerLib"

results in this

Error 3 Character ';', hexidecimal value 0x3b is illegal in an XML name.\BindNonText\CSharp\Page1.xaml 5 56 BindNonTextProperty

and this

Error 4 Missing required whitespace. \BindNonText\CSharp\Page1.xaml 5 57 BindNonTextProperty

NIK




Recovering MSFT-SDE
NickNotYet

I was able to get around the problem by simply specifiying the MyData implementation as belonging to the same namespace as the application.

in MyData.cs

namespace BindNonTextPropertySample

then the sample code compiles just fine, which makes sense.

<DockPanel Name="root"

xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"

xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

xmlns:cider="clr-namespace:BindNonTextPropertySample"

>

<DockPanel.Resources>

<cider:MyData x:Key="myDataSource"/>

</DockPanel.Resources>

<DockPanel DockPanel.Dock="Top" HorizontalAlignment="Left" VerticalAlignment="Top">

<DockPanel.DataContext>

<Binding Source="{StaticResource myDataSource}"/>

</DockPanel.DataContext>

<Button Background="{Binding Path=ColorName}" Width="150" Height="30">I am bound to be RED!</Button>

</DockPanel>

</DockPanel>




Recovering MSFT-SDE
NickNotYet

Bummer, I still get the error in the designer, which prevents me from doing UI layout visually

:(

Error 7 Assembly '' could not be found. Are you missing an assembly reference? FilterTextForm.xaml 4 13 WPF Spectral Devic





Recovering MSFT-SDE
NickNotYet

I'm a little confused about what you've tried and not tried with respect to the workaround.

What you need to do in order to get this to work in Cider is:

1) Move any user types (i.e. types you are providing in your code) that you want to reference from XAML in a separate assembly from the XAML files that wish to reference it

2) Build that library assembly

3) In the project that has the XAML files that reference those user defined types, add a file reference (browse to the assembly, do not add a project reference, better yet, don't have the library assembly in your solution -- there are situations where that won't work) to the library assembly.

4) Update the xmlns:cider="clr-namespace:SliderAdornerLib;assembly=SliderAdornerLib" declaration in your file to reference the correct CLR namespace that your types are in and the assembly name of the library assembly.

You should then be able to use your types in the XAML files.




Jim Nakashima, Microsoft. (This post is provided "as-is")
Jim Nakashima - MSFT
reply 6

You can use google to search for other answers

 

More Articles

• August CTP - is it ready?
• Data binding and images
• Hosting Cider Designer in my Application
• Can't clear Background color
• Editing XAML - am I missing something ?
• Cider Designer Problem/Bug
• When will Cider be available for C++ developement?
• Usercontrol preview
• WinFX Data Binding using VS 2005
• 3D samples in Windows SDK not modified for feb CTP
Welcome to Bokebb   New Update   Joins the collection  
 

New Articles

• How can I eliminate the border and highl
• App throws exception if property value i
• BSOD when running Cider
• Need help to make a strategic decision.
• forcing uppercase in text
• Delete controls in Designer
• Fidalgo vs Orcas
• Install problem?
• Q&A: .Net Framework 3.0 JulyCTP and
• Warning: ZIndex attribute is not declared
• CTP's
• How to delete a control on a form?
• Cannot download Expression Graphic Desig
• Cider in XAML mode by default
• Preview version available?

Hot Articles

• How to apply multi Transforms to Canvas.
• forcing uppercase in text
• Problem uninstalling orcas march ctp
• Can't Access Cider
• Fidalgo vs Orcas
• Cider type initializer error
• Adding Custom Control to Cider Toolbox -
• Accessing objects/controls within templa
• When will Cider be available for C++ dev
• SplitView Designer/Xaml store problems
• Toolbar with Image control in XAML Page
• Object null/InvalidCastException
• Cider Glossary
• Need help to make a strategic decision.
• Hidding a Sub-Grid with in the MainGrid(

Recommend Articles

• Unnecessary fractions
• Custom Control Support in Cider
• Databinding, Templates
• design time features in feb. ctp
• Window style not reflected in Cider desi
• Package Load Failure
• Announcing the Cider May CTP! (for WinFX
• Adding Custom Control to Cider Toolbox -
• Moving a control on a Canvas at run time
• forcing uppercase in text
• XAML images
• Resource Dictionaries
• MouseEvents (WindowStyle"None"
• When will Cider be available for C++ dev
• XAML without cider?