- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
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?
Solved! Go to Solution.