-
Notifications
You must be signed in to change notification settings - Fork 987
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
In .NetCore project, Changes made in the Designer not being Serialized in the Designer.cs file. #11664
Comments
@Olina-Zhang can your team please test? |
Hi @Olina-Zhang , But see the toolStripTabItem's doesn't added in any parent control such as Form1 or customTabControl1. this is the issue, Actually, I wanted a case like if I add toolStripTabItem via SmartTag of the customTabControl then it'll need to directly be added in the header of the customTabControl1. is there any solution for achieving this case? |
Hi @Sekar47, created a sample app, please take a look: |
Hi @Olina-Zhang , Thank you for the sample code provided. please refer the attached sample. in my case, we are using CodeDomSerializer in our TabControlHeaderSerializer class to handle header serialization for the CustomTabControl. Could you please provide guidance or suggestions on how to properly use CodeDomSerializer in this scenario? Specifically, we are facing issues where changes made to the TabItem via the smart tag support are not reflected in the Designer.cs file. Is there a recommended approach or best practices for using CodeDomSerializer to ensure that the designer updates correctly and reflects changes made in the UI? Any insights or examples on how to resolve this issue while continuing to use CodeDomSerializer would be greatly appreciated. Thank you for your assistance. |
@LeafShi1 - I took a quick look at the sample project, it seems that DesignerAction panel is implemented correctly, only the serializer is not discovered on
Could you or your team investigate if anything is missing in the project or if this is a designer bug. If this is a designer bug, please move the issue to the designer repo. |
@Sekar47 this is a fragment of your code. public class ObservableList<T> : IList
{
#region Constructors
public ObservableList()
{
list = new ArrayList();
}
#endregion
#region Properties
/// <summary>
///
/// </summary>
public int Count
{
get { return this.List.Count; }
}
/// <summary>
///
/// </summary>
protected IList List
{
get { return this; }
} I think you might want to replace protected IList List
{
get { return this; }
} with protected IList List
{
get { return list; }
} This is the generated code after the change. private void InitializeComponent()
{
customTabControl1 = new CustomTabControl();
toolStripTabItem1 = new ToolStripTabItem();
toolStripTabItem2 = new ToolStripTabItem();
SuspendLayout();
//
// customTabControl1
//
customTabControl1.Header.AddMainItem(toolStripTabItem1);
customTabControl1.Header.AddMainItem(toolStripTabItem2);
customTabControl1.Location = new System.Drawing.Point(299, 104);
customTabControl1.Name = "customTabControl1";
customTabControl1.Size = new System.Drawing.Size(150, 150);
customTabControl1.TabIndex = 0;
//
// toolStripTabItem1
//
toolStripTabItem1.Name = "toolStripTabItem1";
toolStripTabItem1.Size = new System.Drawing.Size(23, 23);
//
// toolStripTabItem2
//
toolStripTabItem2.Name = "toolStripTabItem2";
toolStripTabItem2.Size = new System.Drawing.Size(23, 23);
//
// Form1
//
AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
ClientSize = new System.Drawing.Size(700, 422);
Controls.Add(customTabControl1);
Name = "Form1";
Text = "Form1";
ResumeLayout(false);
}
#endregion
private CustomTabControl customTabControl1;
private ToolStripTabItem toolStripTabItem1;
private ToolStripTabItem toolStripTabItem2; do you think this is the expected result? |
Hi @Epica3055 , Thank you for your response and suggestions. We implemented the recommended change to the ObservableList class, but unfortunately, the issue persists. Adding ToolStripTabItem via the SmartTag does not serialize properly into the Header of customTabControl1 in the Designer.cs file. We’ve attached an updated sample and a video demonstration for clarity. Could you kindly review and provide further guidance on resolving this issue or suggest alternative approaches to achieve this expecting behavior? |
Environment
Edition - Windows 11 Enterprise
Version - 23H2
OS build - 22631.3737
Visual Studio version - 17.10.4
.NET version
.Net 6,7,8
Did this work in a previous version of Visual Studio and/or previous .NET release?
No, it's not working in previous versions of netcore
Issue description
We are attempting to add items to a collection and serialize them in the designer class using the serializer class which inherits from CodeDomSerializer. However, this is not triggering whenever changes are made in the designer, resulting in the modifications not being serialized in the designer.cs file. Is this a limitation, or are there alternative solutions available?
CustomControl_Tab (2) 1.zip
Steps to reproduce
1.In the Designer, Drag and Drop the CustomTabControl from ToolBox.
2.Click on AddTabItem option from Smart tag, you can add the tab items but it is not available in designer.cs file.
Diagnostics
No response
The text was updated successfully, but these errors were encountered: