I have built a GUI with XAML and Powershell. The problem is that certain visual elements such as dropdown menus are not visible when viewing the application remotely via VNC.
My search led me to this piece of code that I am supposed to run in the OnLoad method of the window to force the RenderMethod to SoftwareOnly:
RenderOptions.ProcessRenderMode = System.Windows.Interop.RenderMode.SoftwareOnly;
However, this is C#. My code-behind is Powershell.
So is there a way to either do this in Powershell, or to set the RenderMethod of the Windows in the XAML file?
The real reason I'm asking this question is because the answers provided here do not work for me. The alpha-blending option simply does not exist in recent versions of UVNC.
Related
Good day, I want to port my Windows Forms App to WPF, I have been investigating and I know that it's almost impossible to port it because of the designer.cs files of Winforms and WPF uses .XAML, but, this web pageconverts your designer files to XAML, so, it is still possible?
You can't port YourForm.Designer.cs because the System.Windows.Forms and System.Windows.Controls are different classes. But there's still a way. Add the namespace of Windows Forms to XAML code. Then, use a WindowsFormsHost. You may add them only with WindowsFormsHost. Then, just copy your methods to C# code of WPF application.
Note: Do not forget to name your controls in WindowsFormsHost correctly.
Note 2: You must check your code after that operations. Because something may need to change.
So I'm currently working on a C# Windows Form App in Visual Studio 2017
What I'd like to do is create several different external Panel files, then switch them out on the main form as the user navigates around.
I used this same technique for a Java GUI before and it worked great.
However I can't seem to figure out how to create the external Panel file, is it possible or am I just wasting my time and energy on the impossible?
(edit) So if anyone is interested I've found a work around for my problem.
By using a winforms user control class I was able to create a working substitute.
We have recently converted an old VB6 application to VB.NET via VS2008. The program is being launched via a c# WPF project that brings up the some of the VB.NET Forms ad hoc.
There is an issue with the way some of the controls that are being displayed.
If for example we add a new button (Button1) control like this:
When compiled it displays like this:
So the "Close" button was converted in and the "Button1" was added after conversion. The styles of the buttons are obviously being effect somewhere.
I have looked in the design file and I can't see anything obvious.
How is this handled?
I think this may be due to the Enable Visual Styles Setting. I'm guessing this was not set to True when the project was upgraded? Possibly an automatic thing so that the application looks as similar to the original as possible.
More Info here: http://msdn.microsoft.com/en-us/library/microsoft.visualbasic.applicationservices.windowsformsapplicationbase.enablevisualstyles(v=vs.110).aspx
And here: http://msdn.microsoft.com/en-us/library/aa984291(v=vs.71).aspx
I'm trying to click a button on a windows application from other application. Basically, I want to click app B's button from app A's code.
I can use winapi findWindow to get a handler. The problem is that I have no idea the name of the button on the app B. Is this possible to list all the names or ids of an application?
I'm using c# to make it happen.
Since you're looking at suggestions (it's a pretty generic question really, it might or might not work depending on what other app/window is, is it e.g. browser or a 3rd party app etc., does it support automation)
Take a look at this closely related answer (it might be a duplicate but you're kind of 'looking for' still so maybe note).
Accessing Elements from Other Processes
Also this one on how to 'access' other app's 'inputs'
Pinvoke SetFocus to a particular control
I have not tested this. But it looks like a intressting libary. Maybe there is some function you can use. It is called White. This is just a sample:
Application application = Application.Launch("foo.exe");
Window window = application.GetWindow("bar", InitializeOption.NoCache);
Button button = window.Get<Button>("save");
button.Click();
You can use tool such as Spy++ (included in any Visual Studio except Express editions) to find name and class of that button and then use these information as parameters of FindWindow().
I'm newbie for Windows phone 7 development.
Usually the User interface Design is done with a Designer and Drag & Drop. But In my project I have to code all user interface programmatically, that is manually write design controls in .Cs file instead of .xaml file.
Is it possible? I have tried googling it, I haven't found any tutorial or documentation yet.
Could someone please help me to start my process.refer some documentation or books
Thanks
I definitely think you can do everything without XAML if you want to.
The basic approach should be to create a basic app with App.xaml and an almost empty Page.xaml. After this you should be able to dynamically add controls to meet your needs.
The majority of this work is quite straight-forward
creating controls, setting properties, adding event handlers are all easy.
The more awkward things will be things like producing animations, visual states, styles and databindings - the XAML syntax for these is quite convenient compared to the C#
Also, if you need multiple pages, then using navigation is also a bit more awkward - the NavigationService is currently built around XAML-based pages.
In iron7, I've written lots of single page apps without using XAML. All the code is in IronRuby rather than C#. As a developer, I think you should be able to follow most of them - take a look at these examples on script.iron7.com:
create a UI with some text boxes and some buttons
a calculator with animations
fingerpaint - canvas and "mouse" touch
panorama control and pivot control
Tetris
To run these scripts just download iron7free from the marketplace. To convert them back into C# is mainly a case of removing some "_" characters, modifying some capitalization and turning def's into C# methods.
Note - for clarification, I am not recommending you write your app in Ruby - it's just that these are the only examples I have of writing an app in code instead of XAML.
You have to create a basic xaml page first with at least a stack panel on it.
Then you can add controls to your stack panel like this
TextBox textbox = new Textbox();
textbox.Text = "TEST";
PageStackPanel.Children.Add(textBox);
You do have drag and drop ability for the Windows Phone 7 development. Download the Visual Studio for Windows Phone 7 and try the samples. http://www.microsoft.com/express/Phone/
Here is a tutorial for the starters:
http://blogs.msdn.com/b/somasegar/archive/2010/03/15/introducing-windows-phone-7-development-tools.aspx
Well its the Silverlight framework. You can code it by hand using XAML (eXtensible Application Markup Language)
Charles Petzold is writing a book on Windows Phone 7 programming, you can download it free here:
http://www.charlespetzold.com/
Generally I don't like the designer and try to avoid it as much as possible. I find writing Xaml easier.
But I also try to avoid the use of Xaml because:
Performance: the C# code is definitely faster
Programming style: I hate when the related code is scattered over several files. It's not only my C# code, but also hidden auto-generated code (sometimes containing unnecessary constructs).
Debugging: Xaml allows for more bugs (e.g. incorrect spelling), Xaml bugs are more difficult to localize
Having said that, I have to disagree with Stuart: Certain things cannot be done in C#, you need to do them in Xaml. For example:
Visual states: You cannot set readonly property VisualStateGroup.Name in C#, but you can use x:Name attribute in Xaml.
UserControl.Content is protected (for SVL3 and thus also for WP7), but Xaml bypasses this limitation
Etc. (There are more such special things.)