Open neoxeo opened 10 months ago
@neoxeo, I will build new nugets and design packages and will check this. BTW I do not use Alternet.UI vsix during development. Also I prefer to create forms with c# code as they are faster and require less time to create. What are the reasons for you to use uixml?
@generalloki
Ok, tell me if you can reproduce or not.
I use uixml because you can see the result of UI in real time and adjust it manually. Margin is always a mystery for me. I don't understand what is the reference point for each component (0, 0 or the the previous component or ... )
For example, how to create a label, under label a textbox and at right of textbox a button ?
Margin and Padding are like in Html. They only change component's Size. Padding changes child controls TopLeft. Margin doesn't change child controls TopLeft
Thanks.
I will experiment this...
Here is interesting link to understand padding, margin, border, Alignment... : https://learn.microsoft.com/en-us/dotnet/desktop/wpf/advanced/alignment-margins-and-padding-overview?view=netframeworkdesktop-4.8
@generalloki
@neoxeo, I will build new nugets and design packages and will check this. BTW I do not use Alternet.UI vsix during development. Also I prefer to create forms with c# code as they are faster and require less time to create. What are the reasons for you to use uixml?
Did you have time to test this. I try to create UI with C# code but very hard for me because before, I only use Winforms with Designer ?
I test this :
Grid grid = new Grid();
Label label1 = new Label();
TextBox txtboxPath = new TextBox();
Button btnPath = new Button();
ComboBox cmbBoxMainForm = new ComboBox();
Button btnMig = new Button();
CheckBox chkBoxPathSol = new CheckBox();
CheckBox chkBoxFileRep = new CheckBox();
CheckBox chkBoxFrame = new CheckBox();
CheckBox chkBoxNet = new CheckBox();
TextBox txtboxDebug = new TextBox();
Label lblResult = new Label();
Label lblOutput = new Label();
// Create and configure the Grid
grid.Margin = new Thickness(0, 0, 155, 0);
// Create and configure the Label
label1.Text = "Choose a Winforms project :";
label1.HorizontalAlignment = HorizontalAlignment.Left;
label1.Height = 27;
label1.Margin = new Thickness(18, 17, 0, 0);
label1.VerticalAlignment = VerticalAlignment.Top;
label1.Width = 125;
grid.Children.Add(label1);
// Create and configure the TextBox
txtboxPath.HorizontalAlignment = HorizontalAlignment.Left;
//txtboxPath.Height = 25;
txtboxPath.Margin = new Thickness(18, 44, 18, 0);
//txtboxPath.TextWrap = TextBoxTextWrap.Best;
txtboxPath.VerticalAlignment = VerticalAlignment.Top;
//txtboxPath.Width =624;
grid.Children.Add(txtboxPath);
// Create and configure the Button
btnPath.Text = "...";
btnPath.Click += btnPath_Click;
btnPath.HorizontalAlignment = HorizontalAlignment.Left;
btnPath.Height = 25;
btnPath.Margin = new Thickness(563, 44, 0, 0);
btnPath.VerticalAlignment = VerticalAlignment.Top;
btnPath.Width = 66;
grid.Children.Add(btnPath);
// Create and configure the ComboBox
cmbBoxMainForm.Text = "None";
cmbBoxMainForm.Name = "cmbBoxMainFormForm";
cmbBoxMainForm.HorizontalAlignment = HorizontalAlignment.Left;
cmbBoxMainForm.Height = 20;
cmbBoxMainForm.Margin = new Thickness(18, 90, 0, 0);
cmbBoxMainForm.VerticalAlignment = VerticalAlignment.Top;
cmbBoxMainForm.Width = 611;
grid.Children.Add(cmbBoxMainForm);
// Create and configure the Button
btnMig.Text = "Migrate project";
btnMig.Click += btnMigrate_Click;
btnMig.HorizontalAlignment = HorizontalAlignment.Left;
btnMig.Height = 28;
btnMig.Margin = new Thickness(18, 115, 0, 0);
btnMig.VerticalAlignment = VerticalAlignment.Top;
btnMig.Width = 611;
grid.Children.Add(btnMig);
// Create and configure the CheckBox
chkBoxPathSol.Text = "Open folder of new solution after migration";
chkBoxPathSol.Name = "chkBoxPathSol";
chkBoxPathSol.IsChecked = true;
chkBoxPathSol.HorizontalAlignment = HorizontalAlignment.Left;
chkBoxPathSol.Height = 20;
chkBoxPathSol.Margin = new Thickness(18, 162, 0, 0);
chkBoxPathSol.VerticalAlignment = VerticalAlignment.Top;
chkBoxPathSol.Width = 262;
grid.Children.Add(chkBoxPathSol);
// Create and configure the CheckBox
chkBoxFileRep.Text = "Open report file after migration";
chkBoxFileRep.Name = "chkBoxFileRep";
chkBoxFileRep.IsChecked = true;
chkBoxFileRep.HorizontalAlignment = HorizontalAlignment.Left;
chkBoxFileRep.Height = 20;
chkBoxFileRep.Margin = new Thickness(18, 184, 0, 0);
chkBoxFileRep.VerticalAlignment = VerticalAlignment.Top;
chkBoxFileRep.Width = 262;
grid.Children.Add(chkBoxFileRep);
// Create and configure the CheckBox
chkBoxFrame.Text = "Framework 4.8";
chkBoxFrame.IsChecked = true;
chkBoxFrame.HorizontalAlignment = HorizontalAlignment.Left;
chkBoxFrame.Height = 20;
chkBoxFrame.Margin = new Thickness(324, 160, 0, 0);
chkBoxFrame.VerticalAlignment = VerticalAlignment.Top;
chkBoxFrame.Width = 262;
grid.Children.Add(chkBoxFrame);
// Create and configure the CheckBox
chkBoxFrame.Text = ".Net 8.0";
chkBoxFrame.IsChecked = false;
chkBoxFrame.HorizontalAlignment = HorizontalAlignment.Left;
chkBoxFrame.Height = 20;
chkBoxFrame.Margin = new Thickness(324, 185, 0, 0);
chkBoxFrame.VerticalAlignment = VerticalAlignment.Top;
chkBoxFrame.Width = 262;
grid.Children.Add(chkBoxFrame);
// Create and configure the TextBox
txtboxDebug.Name = "txtboxDebug";
txtboxDebug.HorizontalAlignment = HorizontalAlignment.Left;
txtboxDebug.Height = 384;
txtboxDebug.Margin = new Thickness(18, 212, 18, 0);
txtboxDebug.Multiline = true;
txtboxDebug.TextWrap = TextBoxTextWrap.Best;
txtboxDebug.VerticalAlignment = VerticalAlignment.Top;
//txtboxDebug.Width = 611;
grid.Children.Add(txtboxDebug);
// Create and configure the Label
lblResult.Name = "lblResult";
lblResult.HorizontalAlignment = HorizontalAlignment.Left;
lblResult.Height = 23;
lblResult.Margin = new Thickness(18, 401, 0, 0);
lblResult.VerticalAlignment = VerticalAlignment.Top;
lblResult.Width = 287;
grid.Children.Add(lblResult);
// Create and configure the Label
lblOutput.Name = "lblOutput";
lblOutput.HorizontalAlignment = HorizontalAlignment.Left;
lblOutput.Height = 23;
lblOutput.Margin = new Thickness(18, 428, 0, 0);
lblOutput.VerticalAlignment = VerticalAlignment.Top;
lblOutput.Width = 287;
grid.Children.Add(lblOutput);
// Finally, add the Grid to the Window
this.Children.Add(grid);
But TextBoxes have too small width and chkBoxFrame does not appear. Thanks for your help.
@neoxeo
Thanks a lot for your advices !
@generalloki
With your help and this fantastic website : https://wpf-tutorial.com/en/1/about-wpf/what-is-wpf (it describe quickly but with the most important informations) how WPF and XAML work.
Here is my first XAML works like I want :
<Window xmlns="http://schemas.alternetsoft.com/ui/2021"
xmlns:x="http://schemas.alternetsoft.com/ui/2021/uixml"
x:Class="Mig2AlternetUI.MainWindow"
Title="Mig2ANUI Alpha_0.0.1.3"
Width="750" Height="715" StartLocation="CenterScreen">
<Grid Margin="10">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="500*" />
<ColumnDefinition Width="300" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Label Grid.Row="0" Grid.Column="0" Text="C# Project Path :" Margin="10,5,0,0" />
<TextBox Grid.Row="1" Grid.ColumnSpan="2" Text="Enter Project path" Name="txtboxPath" TextChanged="txtboxPath_TextChanged" Click="txtboxPath_Click" Margin="10,5"/>
<Button Grid.Row="1" Grid.Column="2" Text="..." Name="btnPath" Click="btnPath_Click" Margin="10,5,0,0"/>
<Label Grid.Row="2" Grid.Column="0" Text="Choose a main form :" Margin="10,5,0,0"/>
<ComboBox Grid.Row="3" Grid.ColumnSpan="3" Text="None" Name="cmbBoxMainForm" Margin="10,5,0,0"/>
<Button Grid.Row="4" Grid.ColumnSpan="3" Text="Migrate project" Name="btnReport" Click="btnMigrate_Click" Margin="10" />
<CheckBox Grid.Row="5" Grid.Column="0" Text="Open folder of new solution after migration" Name="chkBoxPathSol" IsChecked="True" Margin="10,5,0,0" />
<CheckBox Grid.Row="6" Grid.Column="0" Text="Open report file after migration" Name="chkBoxFileRep" IsChecked="False" Margin="10,5,0,0"/>
<CheckBox Grid.Row="5" Grid.Column="1" Text="Framework 4.8" Name="chkBoxFrame" IsChecked="True" Margin="10,5,0,0"/>
<CheckBox Grid.Row="6" Grid.Column="1" Text=".Net 8.0" Name="chkBoxNet" IsChecked="False" Margin="10,5,0,0"/>
<TextBox Grid.Row="7" Grid.ColumnSpan="3" Text="" Name="txtboxDebug" Multiline="True" Margin="10,15,0,0" />
<Label Grid.Row="8" Grid.Column="0" Text="" Name="lblResult" Margin="10, 15,10,0" />
<Label Grid.Row="9" Grid.Column="0" Text="" Name="lblOutput" Margin="10, 10,10,0"/>
</Grid>
</Window>
Now I will try to convert it into C# code.
Design is always KO
@neoxeo, UiXml preview now works fine in the new beta VSIX. I have fixed this yesterday. I am closing this issue. If it doesn't work in your configuration, please let me know.
@generalloki
I have re-compile to have new VSIX, install it and try it.
I have always error :
21:56:34.914 [Verbose] Started AlternetUIDesigner.StartProcessAsync()
21:56:34.914 [Verbose] 0 Started PreviewerProcess.StartAsync()
21:56:34.915 [Debug] StartAsync could not find executable
System.IO.FileNotFoundException: Could not find 'C:\Users\Testeur1\source\repos\ImageProcessing_ANUI\bin\x64\Debug\net48\ImageProcessing1.exe'. Please build your project to enable previewing and intellisense.
à Alternet.UI.Integration.VisualStudio.Services.PreviewerProcess.<StartAsync>d__35.MoveNext() dans C:\Users\Testeur1\source\repos\AlternetUI-MasterWithWebBrowser\Source\Integration\VisualStudio\Alternet.UI.Integration.VisualStudio\Services\PreviewerProcess.cs:ligne 179
--- Fin de la trace de la pile à partir de l'emplacement précédent au niveau duquel l'exception a été levée ---
à System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
à System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
à System.Runtime.CompilerServices.TaskAwaiter.GetResult()
à Alternet.UI.Integration.VisualStudio.Views.AlternetUIDesigner.<StartProcessAsync>d__51.MoveNext() dans C:\Users\Testeur1\source\repos\AlternetUI-MasterWithWebBrowser\Source\Integration\VisualStudio\Alternet.UI.Integration.VisualStudio\Views\AlternetUIDesigner.xaml.cs:ligne 466
21:56:34.915 [Verbose] Finished AlternetUIDesigner.StartProcessAsync()
Search path is : C:\Users\Testeur1\source\repos\ImageProcessing_ANUI\bin\x64\Debug\net48\ImageProcessing1.exe
Real path is : C:\Users\Testeur1\source\repos\ImageProcessing_ANUI\bin\Debug\net48\ImageProcessing1.exe There is no "x64" in path
@neoxeo , Here is a link to 0.9.503 build
https://drive.google.com/drive/folders/1Ij8W3ryEGxcTOqNG-QxoR2SL1fEm-qMj?usp=sharing
Could you please try this?
@generalloki
I have uninstalled VSIX 9.504 version. Install your VSIX 9.503 version.
Remove 9.504 nupkg packages in my project Add your 9.503 nupkg packages in my project
Clean my project. Generate my project.
Try to open uixml viewer and have this error :
07:19:32.841 [Information] AlterNET UI Package initialized
07:20:10.551 [Verbose] Started EditorFactory.CreateEditorInstance("C:\Users\Testeur1\source\repos\ImageProcessing_ANUI\Form1.uixml")
07:20:10.567 [Verbose] Started EditorFactory.GetTextBuffer("C:\Users\Testeur1\source\repos\ImageProcessing_ANUI\Form1.uixml")
07:20:10.645 [Verbose] Finished EditorFactory.GetTextBuffer("C:\Users\Testeur1\source\repos\ImageProcessing_ANUI\Form1.uixml")
07:20:10.645 [Verbose] Started EditorFactory.CreateEditorControl()
07:20:11.571 [Verbose] Finished EditorFactory.CreateEditorControl()
07:20:11.587 [Verbose] Finished EditorFactory.CreateEditorInstance("C:\Users\Testeur1\source\repos\ImageProcessing_ANUI\Form1.uixml")
07:20:11.697 [Verbose] Started DesignerPane.Initialize()
07:20:11.744 [Verbose] Started AlternetUIDesigner.Start()
07:20:11.744 [Verbose] Started AlternetUIDesigner.LoadTargetsAndStartProcessAsync()
07:20:11.759 [Verbose] Started AvaloniaDesigner.LoadTargetsAsync()
07:20:11.791 [Verbose] Finished AvaloniaDesigner.LoadTargetsAsync()
07:20:11.791 [Verbose] Finished AlternetUIDesigner.LoadTargetsAndStartProcessAsync()
07:20:11.791 [Verbose] Finished AlternetUIDesigner.Start()
07:20:11.791 [Verbose] Finished DesignerPane.Initialize()
07:20:12.136 [Verbose] Started AlternetUIDesigner.CreateCompletionMetadataAsync() for "C:\Users\Testeur1\source\repos\ImageProcessing_ANUI\bin\Debug\net48\ImageProcessing1.exe"
07:20:12.136 [Verbose] Started AlternetUIDesigner.StartProcessAsync()
07:20:12.136 [Verbose] Started AlternetUIDesigner.CreateCompletionMetadataAsync() for "C:\Users\Testeur1\source\repos\ImageProcessing_ANUI\bin\Debug\net48\ImageProcessing1.exe"
07:20:12.215 [Verbose] 0 Started PreviewerProcess.StartAsync()
07:20:12.215 [Debug] StartAsync could not find executable
System.IO.FileNotFoundException: Could not find executable 'c:\users\testeur1\appdata\local\microsoft\visualstudio\17.0_b92255b5\extensions\dicqwguz.tuk\UIXmlHostApp\DotNetFx\Alternet.UI.Integration.UIXmlHostApp.exe'. Please build your project to enable previewing and intellisense.
à Alternet.UI.Integration.VisualStudio.Services.PreviewerProcess.
### Error : c:\users\testeur1\appdata\local\microsoft\visualstudio\17.0_b92255b5\extensions\dicqwguz.tuk\UIXmlHostApp\DotNetFx\Alternet.UI.Integration.UIXmlHostApp.exe'. Please build your project to enable previewing and intellisense.
Why it search "DotNetFx" ?
Here is the content of folder "c:\users\testeur1\appdata\local\microsoft\visualstudio\17.0_b92255b5\extensions\dicqwguz.tuk\UIXmlHostApp\"
@generalloki
I have sent you a mail wit a link to download my project if you need.
I have checked testAnui_09.411.zip and it opens fine. I have tried with vsix from 0.9.503 and not local packages. The only problem is that Button is shown over transparent background. But If I place Panel and button inside of it, form is shown fine. IF you send me test project with the problem I will check it. The other problem could be that you need to wait some time before opening uixml, in order to allow vsix to load properly.
@generalloki
Sorry I don't understand. I have already sent you a mail with the project (2 posts before this one). Here is the link : https://drive.google.com/file/d/1w6AsIPC9UzMz5v4vRMX4VGUnPAL29Fxf/view?usp=sharing
@neoxeo
I did not receive any e-mails with this project and also don't see any urls in previous posts, maybe I missed something. Anyway I have tried the project. When project has
@generalloki
Test with .Net8.0 is ok. I don't understand why you havn't receive mail. Sorry
Can you tell me why picturebox are not visible in the previewer even if I add HasBorder="True" in uixml ?
Thanks
I have modified vsix so now it should work under dotnet48.
@generalloki
Verify test project target framework is net48 Pull last commit, regenerate Integration project, Insatll VSIX package, Open test project, Generate, Open UIXML : OK
Issue solved.
Thanks
@neoxeo , Thanks for helping us!
@generalloki
Always problem with previewer in VS2022 :
Version : ee6e0ce897070fb8b6ae6164b230441a4653bf90
I work with LayoutSample and previewer search "Source\Samples\AuiManagerSample\bin\Debug\net480\AuiManagerSample.exe"
08:12:45.121 [Debug] StartAsync could not find executable
System.IO.FileNotFoundException: Could not find executable 'C:\Users\Testeur1\source\repos\AlternetUI-MasterWithWebBrowser\Source\Samples\AuiManagerSample\bin\Debug\net480\AuiManagerSample.exe'. Please build your project to enable previewing and intellisense.
à Alternet.UI.Integration.VisualStudio.Services.PreviewerProcess.<StartAsync>d__35.MoveNext() dans C:\Users\Testeur1\source\repos\AlternetUI-MasterWithWebBrowser\Source\Integration\VisualStudio\Alternet.UI.Integration.VisualStudio\Services\PreviewerProcess.cs:ligne 186
--- Fin de la trace de la pile à partir de l'emplacement précédent au niveau duquel l'exception a été levée ---
à System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
à System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
à System.Runtime.CompilerServices.TaskAwaiter.GetResult()
à Alternet.UI.Integration.VisualStudio.Views.AlternetUIDesigner.<StartProcessAsync>d__51.MoveNext() dans C:\Users\Testeur1\source\repos\AlternetUI-MasterWithWebBrowser\Source\Integration\VisualStudio\Alternet.UI.Integration.VisualStudio\Views\AlternetUIDesigner.xaml.cs:ligne 466
08:12:45.121 [Verbose] Finished AlternetUIDesigner.StartProcessAsync()
08:12:47.177 [Verbose] Finished AlternetUIDesigner.CreateCompletionMetadataAsync() took 00:00:02.0681808 for "C:\Users\Testeur1\source\repos\AlternetUI-MasterWithWebBrowser\Source\Samples\AuiManagerSample\bin\Debug\net480\AuiManagerSample.exe"
Is this issue for vs2022 only? I am on linux and would love a uixml preview for vscode
@Shadowblitz16
There will be standalone independent cross platform previewer in one of the next builds. Currently it is only for VS2022
@generalloki
I have alaways errors with Design and can't see UI :
I have compiled new version of Alternet.UI.Integration.VisualStudio.VS2022.vsix and install it in VS2022 but error always present. Impossible to see Design even if I add only simple component like button :
Error :
Here is the simple project if necessary : testAnui_09.411.zip
Code can be compiled and works.