- jc_lvngstn
- Posts: 34
- Joined:
Game dialog/window layout
I remember a previous discussion on this but can't find the thread.
I currently have this as my main UI Window:
All my my game windows such as inventory, or a dialog window, etc are just UserControls. When I want to show one, I just create the usercontrol via code and add it to the "UI_Windows" children via this:
GetChildren().Add(newWindow);
This works ok...except when some windows are added as children, they distort the other windows. They will resize if I add another window, to match its height at times.
I don't know if this is because UI_Windows is a grid control.
Is there a better way to add/remove dynamic windows to the UI, without affecting others? Should I just remove the parent UI_Windows grid control, and add new Usercontrols inside their own canvases and set their positions, etc?
Thanks,
JC
I currently have this as my main UI Window:
Code: Select all
<Canvas
Name="UI_MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:UserControls="clr-namespace:UserControls"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
mc:Ignorable="d">
<Grid Name="UI_Windows">
</Grid>
</Canvas>
All my my game windows such as inventory, or a dialog window, etc are just UserControls. When I want to show one, I just create the usercontrol via code and add it to the "UI_Windows" children via this:
GetChildren().Add(newWindow);
This works ok...except when some windows are added as children, they distort the other windows. They will resize if I add another window, to match its height at times.
I don't know if this is because UI_Windows is a grid control.
Is there a better way to add/remove dynamic windows to the UI, without affecting others? Should I just remove the parent UI_Windows grid control, and add new Usercontrols inside their own canvases and set their positions, etc?
Thanks,
JC
- matt.rudder
- Posts: 21
- Joined:
- Location: San Francisco, CA
- Contact:
Re: Game dialog/window layout
Your biggest problem here, is the grid is stretching to fit the largest child element you have added. Since there are no row or column definitions defined every element takes up the entire grid space.
If you want the structure of the Grid, you'll have to add the rows and columns to your Grid as shown here: http://noesisengine.com/docs/Gui.Core.L ... orial.html
For something like this though, I would probably get rid of the grid altogether (or make UI_Windows a canvas) and add your window elements to the canvas. Then you can position your UserControls wherever you see fit via attached properties, like so:
If you want the structure of the Grid, you'll have to add the rows and columns to your Grid as shown here: http://noesisengine.com/docs/Gui.Core.L ... orial.html
For something like this though, I would probably get rid of the grid altogether (or make UI_Windows a canvas) and add your window elements to the canvas. Then you can position your UserControls wherever you see fit via attached properties, like so:
Code: Select all
canvas.GetChildren().Add(newWindow);
canvas.SetLeft(newWindow, windowX);
canvas.SetTop(newWindow, windowY);
- jc_lvngstn
- Posts: 34
- Joined:
Re: Game dialog/window layout
How frustrating. I could have sworn I tried this already, it's a pretty obvious solution. /bonk bonk
Regardless..thanks for you help, it works great!
Regardless..thanks for you help, it works great!
Re: Game dialog/window layout
Please, do not resurrect old threads that are marked as solved. Create new ones. Thanks!
Re: Game dialog/window layout
ok,sorry,i just want to bookmark it. just find the function;Please, do not resurrect old threads that are marked as solved. Create new ones. Thanks!
Who is online
Users browsing this forum: camimamedov and 26 guests