[RECOVERED] Dynamic runtime xaml construction with modular windows
Posted: 03 Nov 2018, 23:32
Our database got corrupted and we lost the content of this topic. Please, help us to recover this discussion.
Welcome to our official discussion site. You’ll find topics on features, bugs, development, and general support here
https://www.noesisengine.com/forums/
<UserControl
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
d:DesignWidth="1280" d:DesignHeight="720">
<Grid>
</Grid>
</UserControl>
<UserControl
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d"
xmlns:noesis="clr-namespace:NoesisGUIExtensions"
x:Class="GUI.MainCanvas"
x:Name="MainCanvas"
d:DesignWidth="1280" d:DesignHeight="720"
FontFamily="Fonts/#WeblySleek UI Semilight">
<Grid x:Name="LayoutRoot" RenderTransformOrigin="0.5,0.5">
</Grid>
</UserControl>
using Noesis;
namespace GUI
{
public partial class MainCanvas : UserControl { ... }
}
UserControl root = new UserControl();
root.Content = new Button();
Grid root = new Grid();
root.Children.Add(new Button());
root.Children.Add(new Ellipse { Fill = Brushes.Blue });
<Grid
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<!-- your UI will be added here -->
</Grid>
using UnityEngine;
public LoadUIBehavior : MonoBehavior
{
void Start()
{
NoesisView view = GetComponent<NoesisView>();
Noesis.Grid root = (Noesis.Grid)view.Content;
root.Children.Add(new Button());
...
}
}
Grid root = new Grid();
root.Children.Add(new Button());
root.Children.Add(new Ellipse { Fill = Brushes.Blue });
You are right, I fixed the typo, thanks.shouldn't that beCode: Select allGrid root = new Grid(); root.Children.Add(new Button()); root.Children.Add(new Ellipse { Fill = Brushes.Blue });
No, Noesis keeps track of its own focus.does NoesisGui integrate with Unity's GuiUtility?
such as set focus?
button.Focus();
UIElement focused = root.Keyboard.FocusedElement;