Creating a WPF Print External Command for Revit

Creating a WPF Print External Command for Revit

FlorisvdG
Advocate Advocate
973 Views
1 Reply
Message 1 of 2

Creating a WPF Print External Command for Revit

FlorisvdG
Advocate
Advocate

Hoping to get some help.

 

I'm in the process of creating a printfunction using C# and the Revit APi. I downloaded the revit SDK and found a sample called ViewPrinter. I learned a lot from it, and I want to use some of it. Especially the PrintMgr class, which is based on the build-in class  (Autodesk.Revit.DB.)PrintManager.  Slight hickup is that it's winform based and i'm using WPF.

 

This class PrintMgr uses

public PrintMgr(ExternalCommandData commandData)
        {
            m_commandData = commandData;
            m_printMgr = commandData.Application.ActiveUIDocument.Document.PrintManager;
        }

to assign the current Printmanager to m_printMgr. it uses commandData to do it.

 

The only place i know where commandData is available, is at the EntryPoint (which in my case is in PrintWindowModel 😞

 

public Autodesk.Revit.UI.Result Execute(ExternalCommandData commandData, ref string message, Autodesk.Revit.DB.ElementSet elements)

So i created an instance of PrintMgr (called PrintManager) here. But, and here comes my problem:

How do I bind any data to this class?   I've set datacontext=PWM   (PWM= instance of PrintWindowModel)

 

I tried

text="{Binding PrintManager.PrinterName}"  //Where PrinterName is a property of PrintManager ofcourse

But that doesn't work. 

 

So I guess it comes down to the question:

How do I set a databinding to an instance of a Class, which is instantiated in my datacontext?

 

 

 

 

0 Likes
Accepted solutions (1)
974 Views
1 Reply
Reply (1)
Message 2 of 2

FlorisvdG
Advocate
Advocate
Accepted solution
0 Likes