Visual Studio Design time binding to class object

Visual Studio Design time binding to class object

deddolo
Explorer Explorer
251 Views
0 Replies
Message 1 of 1

Visual Studio Design time binding to class object

deddolo
Explorer
Explorer

I am developing an add-in for Revit 2016 and right now I am using a WPF window to display results in a DataGrid (however the issue I am about to describe also happened while using WinForms)

 

I am trying to format and setup my DataGridView at Design Time but I cannot bind to the main class which implements the API interface IExternalCommand. 

 

<Transaction(TransactionMode.Manual)>
Public Class MyClass
    Implements Autodesk.Revit.UI.IExternalCommand
....
End Class

 

 

When I try to set the Window datacontext at design time: 

 

<Window x:Class="MainWindow"
       ....
        xmlns:dvm="clr-namespace:MyAssembly"
        d:DataContext="{d:DesignInstance {x:Type dvm:MyClass}}"
        ....
>

I get the following error:

The name "MyClass" does not exist in the namespace "clr-namespace:MyAssemnbly".

Other than this the add-in compiles and works fine, but I would really need be able to use the Designer to ease the development.

 

What I tried so far (with no success):

- Changing Target Framework from 4 to 4.7 and in between (went back to 4.5)

- Changing target CPU from Any to x64

 

The workaround for now was to create a dummy class and duplicate the properties from the main class.

 

Can this be done? What am I doing wrong?

 

note: when working with WinForms the similar issue was that when defining an Object based DataSource, MyClass would not show up in the list. If I removed the Transaction and Interface implementation (basically making it independent from Revit API assemblies) it did show up.

 

Thank you in advance to anyone who can help me!

 

 

0 Likes
252 Views
0 Replies
Replies (0)