![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
| |
| | #1 (permalink) |
| | WPF COM Interop - How to manipulate the control OK, so I finally figured out how to add a ActiveX control to a WPF form through C# code, as the XAML method does not work for some odd reason (could it be that I'm using VS Express?). Anyways, I can put the control as a child of my DockPanel, but I cannot manipulate the control outside of the function that I created it with. I'm sure that this is a newb mistake, but I'm used to being able to manipulate a control globally. Thanks in advance. |
My System Specs![]() |
| | #2 (permalink) |
| | Re: WPF COM Interop - How to manipulate the control If you created the control as design time, it is probably exposed as a protected member instead of an internal(friend in vb). If you created the control as run time, you will have to keep a reference to the control globally like through a static field. -- Bryan Phillips MCSD, MCDBA, MCSE Blog: http://bphillips76.spaces.live.com "Stefan Nuxoll" <netkid91@gmail.com> wrote in message news:C22A1B72-EADA-43CB-8E17-55E6D8B80A50@microsoft.com: > OK, so I finally figured out how to add a ActiveX control to a WPF form > through C# code, as the XAML method does not work for some odd reason (could > it be that I'm using VS Express?). Anyways, I can put the control as a > child of my DockPanel, but I cannot manipulate the control outside of the > function that I created it with. I'm sure that this is a newb mistake, but > I'm used to being able to manipulate a control globally. Thanks in advance. |
My System Specs![]() |
| | #3 (permalink) |
| | Re: WPF COM Interop - How to manipulate the control To be clear: not through a static field -- add a member variable to the code-behind class instead of declaring it local in the function: (I've made up a class that represents your ActiveX control, called ActiveXControlClass here). public partial class Window1 { private ActiveXControlClass axMyControl; private void CreateAxControl() { axMyControl = new ActiveXControlClass(); // add control to parent, etc... } private void SomeOtherFunction() { axMyControl.SomeProperty = "123"; } Normally VS (and Expresion) hide all of the declarations of the elements on your UI in a file called something like window1.g.cs (in the obj/Debug folder). This file contains the actual fields/members that represent the elements on your user interface (and since it is generated as a part of the compile process, that's why you need to compile the project after adding UI elements to any current visual designer, so that the Intellisense engine can work its magic). Hope that helps. --Aaron http://www.wiredprairie.us "Bryan Phillips" <bphillips@nospam.spamcop.net.spammenot> wrote in message news:ujxEPU2aHHA.2316@TK2MSFTNGP04.phx.gbl... > If you created the control as design time, it is probably exposed as a > protected member instead of an internal(friend in vb). > > If you created the control as run time, you will have to keep a reference > to the control globally like through a static field. > > -- > Bryan Phillips > MCSD, MCDBA, MCSE > Blog: http://bphillips76.spaces.live.com > > > > "Stefan Nuxoll" <netkid91@gmail.com> wrote in message > news:C22A1B72-EADA-43CB-8E17-55E6D8B80A50@microsoft.com: > >> OK, so I finally figured out how to add a ActiveX control to a WPF form >> through C# code, as the XAML method does not work for some odd reason >> (could >> it be that I'm using VS Express?). Anyways, I can put the control as a >> child of my DockPanel, but I cannot manipulate the control outside of >> the >> function that I created it with. I'm sure that this is a newb mistake, >> but >> I'm used to being able to manipulate a control globally. Thanks in >> advance. > |
My System Specs![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| manipulate string output | PowerShell | |||
| Microsoft.VirtualServer.Interop.dll and the Microsoft.VMRCClientControl.Interop.dll | Virtual Server | |||
| Using an interop assembly with interop dependencies | PowerShell | |||
| Using Powershell to manipulate COM+? | PowerShell | |||
| manipulate csv file and cut equivalent | PowerShell | |||