I've been searching for a long time without finding a proper answer to this question. Maybe because it can come up with the right keywords to search for.
However, I have a WinForm with a ElementHost containing some WPF (A UserControl). In WinForm can be resized and I want the WPF to have a different layout/view depending on if the window is in landscape or portrait mode.
What is the best way to design a layout like this in WPF?
I will do the detection of the window aspect ration in my winform OnResize(System.EventArgs e) and send the signal downwards into my ElementHost. The layout should be switched and replaced at runtime.
Pardon me if the terminology is not correct but I'm a bit new to the .NET framework.
Related
I´m designing an desktop app in WPF. My problem is the resolution, the minimum resolution that can support the app is 1024x768(for crt monitors) and in this resolution maximizing the app seems okay and good, but when i try the app in higher resolution then the gap between my components and their size according to resolution seems very very awful and unprofessional specially in very high resolution the empty space which make it more worst and ugly. please suggest me some easy fast guide or documentation please.... thank you
When designing your WPF application, it's advisable to use one of the predefined layouts such as stacklayout, grid, dock panel etc. as these tend to be more responsive than defining the your own static layout.
Check the link below on how you can use these layouts.
https://wpftutorial.net/layoutproperties.html
I currently have the problem to display a OffScreen Control in a WPF context.
I could use the WPF control given by cefsharp, but the problem is that the control only gets initialized when drawable (which is a problem).
Rendering a image is no big deal, but want to display a series of images (no high framerates is needed), also should it not eat the whole performance on the computer while doing this.
Best regards,
Sebastian
I would like to overlay own content above a Direct3D v9 game (made by a third party).
Overlay Interactive Button
Specifically, I would like to overlay a clickable button control, like Steam does, for instance, though I'm attempting a much simpler interface.
Ideally, I would be able to overlay a WPF button or a Windows Form button or whole UserControl, but if that is not possible then creating a functioning button from primitives would suffice as well.
Text Overlay Working with SharpDX
I have a working sample of overlaying text based on the work of Justin Stenning
Namely with the help of SharpDX.Direct3D9.Font DrawText method
How to Overlay a Button or UserControl with SharpDX
I looked through relevant samples in https://github.com/sharpdx/SharpDX-Samples but was not able to find a way to include or draw native controls with SharpDX
Is it possible?
If not, are there any samples of drawing a clickable button from scratch?
Please bear in mind I'm a novice in the DirectX world :)
Your biggest problem isn't going to be getting the controls to render on top of a DX scene; it's going to be getting them to respond to input afterwards. You can probably rig up a way to get the visuals copied to a DX surface, but I have no idea how you would capture input, translate it, and deliver it back to the WPF components. If it's even possible, it's almost certainly more trouble than it's worth.
There are a couple game-oriented Xaml solutions out there that you may want to check out. WPF for Games is a partial C++ implementation of WPF based on Direct3D, and there's also the proprietary Noesis GUI.
We have a bunch of forms with alot of PictureBoxes on them. They're basically a representation of an engineering system with pipes connected to pumps and whatever. Each element is it's own picturebox, so there's a few hundred.
The problem we have is that when we take the app to a large 40"+ TV, there's too much space everywhere and it doesn't look the way it does on the developer's screen. So we designed it for these large TV's but when we look at it on a normal computer screen it's all wrong.
So how do we design the form with pictureboxes for the actual images to resize and reposition the controls relative to the size of the resolution it's being viewed on? If we simply anchor everything then the image sizes themselves are not relative to the display it's seen on.
Much appreciated!
In a Winforms solution you will have to do at least some of the resize calculations if anchoring and docking do not provide you with the required results.
If it is really important to you to be able to design the UI in Visual Studio I recommend writing custom controls that expose the desired resize properties and resize behavior and perhaps even a custom designer to support the design time features.
It might not be feasible but you could consider having a look at WPF, it has a ViewBox control that might simply be the answer to your needs.
I'm writing an app in C# WPF and I'm hoping to implement a similar kind of touch-based horizontal scrolling that's featured prominently in Windows 8.
At the moment I'm using ScrollViewer with content inside it. This works fine as far as the scrolling is concerned, but it creates problems when interacting with controls inside of it (for example, sliders).
With my limited programming knowledge (a month ago the most I'd done was create a mockup in Photoshop :P), I'd assume this was because the touch hits the ScrollViewer first? Is there some way of flipping this around? I would be happy even if you had to hit a white space to be able to scroll, I just need the user to be able to interact with the controls inside easily without accidentally scrolling all over the place ^_^
Unfortunately, I can't just code for Windows 8 as this is specifically for a bunch of touch-enabled Windows 7 machines.
Look for the Metro theme here you might find some usful style here that you can modify and use..
Also you can check this website for information and guidelines on Metro UI on WPF