alternetsoft / AlternetUI

MIT License
22 stars 2 forks source link

AlternetUI can't find custom control. #90

Open Shadowblitz16 opened 6 months ago

Shadowblitz16 commented 6 months ago
using Alternet.UI;

namespace SMBXR.Editor;

public partial class LevelView : Control
{
    public LevelView()
    {
        InitializeComponent();
    }

}
<Control xmlns="http://schemas.alternetsoft.com/ui/2021"
        xmlns:x="http://schemas.alternetsoft.com/ui/2021/uixml"
        x:Class="SMBXR.Editor.LevelView"
        Title="Template"
        BackColor="Black"
        UserPaint="true">

</Control>
<Window xmlns="http://schemas.alternetsoft.com/ui/2021"
        xmlns:x="http://schemas.alternetsoft.com/ui/2021/uixml"
        x:Class="SMBXR.Editor.MainWindow"
        Title="Template">
    <Window.Menu>
        <MainMenu>
            <MenuItem Text="_File">
                <MenuItem Text="Open" Click="OnOpen"/>
                <MenuItem Text="Save" Click="OnSave"/>
                <MenuItem Text="Save As.." Click="OnSaveAs"/>
                <MenuItem Text="-"/>
                <MenuItem Text="Quit" Click="OnQuit"/>
            </MenuItem>
        </MainMenu>
    </Window.Menu>

    <LevelView/>
</Window>

image

generalloki commented 6 months ago

See Source\Tests\CustomControlInUixml project

generalloki commented 6 months ago

We need to find out why it is needed to add 'xmlns:local' when using controls not from the Alternet.UI library

<Window xmlns="http://schemas.alternetsoft.com/ui/2021"
        xmlns:x="http://schemas.alternetsoft.com/ui/2021/uixml"
        x:Class="CustomControlInUixml.MainWindow"
        xmlns:local="clr-namespace:CustomControlInUixml"
        Title="CustomControlInUixml">
  <VerticalStackPanel Name="mainPanel">

    <Label Text="Here is custom control with uixml:" Margin="10"/>

    <local:CustomControl SomeProp="SomeValue" Margin="10" />

    <Label Text="Here it is again:" Margin="10"/>

  </VerticalStackPanel>
</Window>