Standard-Toolkit icon indicating copy to clipboard operation
Standard-Toolkit copied to clipboard

[Bug]: Breadcrumb - Cannot Add items to Root via the designer.

Open giduac opened this issue 3 years ago • 32 comments

Describe the bug The RootItem/Items collection is not accessible via the designer.

Works in NET480 Does not work in Net31/50/60 Tried several TK version including stable, canary and nightlies.

To Reproduce Add a KBreadcrumb to the form Try to add items

Expected behavior N/A

Screenshots N/A

Desktop (please complete the following information):

  • OS: W10/11

Additional context Items can be added programmatically.

giduac avatar Mar 08 '22 09:03 giduac

@Wagnerp This is probably also a candidate to be included in the April release

giduac avatar Mar 17 '22 10:03 giduac

Hi @giduac

Can you provide a video of the bug/exception?

PWagner1 avatar Mar 17 '22 14:03 PWagner1

@Wagnerp there you go,

No exception there. In the designer the breadcrumb property (collection) RootItem->Items has no button to manage those items. At runtime it does show this collection button in a property-grid and items are accessible.

Design time https://user-images.githubusercontent.com/96108132/158830248-2ec53970-3a71-4221-a5f7-b8d2a8939170.mp4

Run time https://user-images.githubusercontent.com/96108132/158830241-12def720-bf13-4bab-a41b-cfdb9317e22f.mp4

giduac avatar Mar 17 '22 14:03 giduac

Hi @giduac

Thanks for posting, looks as if something is missing

PWagner1 avatar Mar 17 '22 14:03 PWagner1

@giduac & @Smurf-IV

Is there anything here that stands out?

image

PWagner1 avatar Mar 17 '22 15:03 PWagner1

@Wagnerp

All works in NET48 Does not work in Net31/50/60 Tried several TK version including stable, canary and nightlies....

giduac avatar Mar 17 '22 15:03 giduac

@Wagnerp

Could this difference be it (taken from KryptonContextMenuCollections.cs) .

According to the docs for Type.AssemblyQualifiedName https://docs.microsoft.com/en-us/dotnet/api/system.type.assemblyqualifiedname?view=net-6.0

[Editor( @"Krypton.Toolkit.KryptonContextMenuCollectionEditor, Krypton.Toolkit", typeof( UITypeEditor ) )]

[Editor( @"Krypton.Toolkit.KryptonBreadCrumbItemsEditor", , typeof( UITypeEditor ) )]

giduac avatar Mar 17 '22 16:03 giduac

@Wagnerp

Could this difference be it (taken from KryptonContextMenuCollections.cs) .

According to the docs for Type.AssemblyQualifiedName https://docs.microsoft.com/en-us/dotnet/api/system.type.assemblyqualifiedname?view=net-6.0

[Editor( @"Krypton.Toolkit.KryptonContextMenuCollectionEditor, Krypton.Toolkit", typeof( UITypeEditor ) )]

[Editor( @"Krypton.Toolkit.KryptonBreadCrumbItemsEditor", , typeof( UITypeEditor ) )]

Might be, lets check

PWagner1 avatar Mar 17 '22 16:03 PWagner1

Hi @giduac

Yes, that works. It'll be in tomorrows nightly build.

PWagner1 avatar Mar 17 '22 16:03 PWagner1

@Wagnerp

Did a search for these editor attribute strings and there are several that are missing the assembly name. Not sure if that will lead to the same problem but having a look at it and test it on the different framework versions might the right thing to do, just to make sure...

Search "[Editor(" (99 hits in 50 files of 1425 searched)
  ** Source\Krypton Components\Krypton.Navigator\Page\KryptonPage.cs (2 hits)
	Line 624:         [Editor(@"System.ComponentModel.Design.MultilineStringEditor", typeof(UITypeEditor))]
	Line 654:         [Editor("System.ComponentModel.Design.MultilineStringEditor", typeof(UITypeEditor))]
  ** Source\Krypton Components\Krypton.Ribbon\Controls Ribbon\KryptonRibbonQATButton.cs (2 hits)
	Line 274:         [Editor("System.ComponentModel.Design.MultilineStringEditor", typeof(UITypeEditor))]
	Line 285:         [Editor("System.ComponentModel.Design.MultilineStringEditor", typeof(UITypeEditor))]
  ** Source\Krypton Components\Krypton.Ribbon\Group Contents\KryptonRibbonGroupComboBox.cs (6 hits)
	Line 424:         [Editor("System.ComponentModel.Design.MultilineStringEditor", typeof(UITypeEditor))]
  ** Source\Krypton Components\Krypton.Ribbon\Group Contents\KryptonRibbonGroupDomainUpDown.cs (2 hits)
	Line 224:         [Editor("System.ComponentModel.Design.MultilineStringEditor", typeof(UITypeEditor))]
  ** Source\Krypton Components\Krypton.Ribbon\Group Contents\KryptonRibbonGroupRichTextBox.cs (2 hits)
	Line 403:         [Editor("System.ComponentModel.Design.MultilineStringEditor", typeof(UITypeEditor))]
  ** Source\Krypton Components\Krypton.Ribbon\Group Contents\KryptonRibbonGroupTextBox.cs (3 hits)
	Line 369:         [Editor("System.ComponentModel.Design.MultilineStringEditor", typeof(UITypeEditor))]
  ** Source\Krypton Components\Krypton.Ribbon\Palette\RibbonAppButton.cs (4 hits)
	Line 355:         [Editor("System.ComponentModel.Design.MultilineStringEditor", typeof(UITypeEditor))]
	Line 369:         [Editor("System.ComponentModel.Design.MultilineStringEditor", typeof(UITypeEditor))]
  ** Source\Krypton Components\Krypton.Toolkit\ButtonSpec\ButtonSpec.cs (4 hits)
	Line 257:         [Editor(@"System.ComponentModel.Design.MultilineStringEditor", typeof(UITypeEditor))]
	Line 290:         [Editor(@"System.ComponentModel.Design.MultilineStringEditor", typeof(UITypeEditor))]
	Line 389:         [Editor(@"System.ComponentModel.Design.MultilineStringEditor", typeof(UITypeEditor))]
	Line 423:         [Editor(@"System.ComponentModel.Design.MultilineStringEditor", typeof(UITypeEditor))]
  ** Source\Krypton Components\Krypton.Toolkit\ContextMenu\KryptonContextMenuHeading.cs (2 hits)
	Line 117:         [Editor(@"System.ComponentModel.Design.MultilineStringEditor", typeof(UITypeEditor))]
	Line 140:         [Editor(@"System.ComponentModel.Design.MultilineStringEditor", typeof(UITypeEditor))]
  ** Source\Krypton Components\Krypton.Toolkit\ContextMenu\KryptonContextMenuItem.cs (3 hits)
	Line 231:         [Editor(@"System.ComponentModel.Design.MultilineStringEditor", typeof(UITypeEditor))]
	Line 255:         [Editor(@"System.ComponentModel.Design.MultilineStringEditor", typeof(UITypeEditor))]
  ** Source\Krypton Components\Krypton.Toolkit\Controls Toolkit\KryptonButton.cs (1 hit)
	Line 155:         [Editor(@"System.ComponentModel.Design.MultilineStringEditor", typeof(UITypeEditor))]
  ** Source\Krypton Components\Krypton.Toolkit\Controls Toolkit\KryptonCheckBox.cs (1 hit)
	Line 226:         [Editor("System.ComponentModel.Design.MultilineStringEditor", typeof(UITypeEditor))]
  ** Source\Krypton Components\Krypton.Toolkit\Controls Toolkit\KryptonColorButton.cs (1 hit)
	Line 274:         [Editor(@"System.ComponentModel.Design.MultilineStringEditor", typeof(UITypeEditor))]
  ** Source\Krypton Components\Krypton.Toolkit\Controls Toolkit\KryptonCommand.cs (2 hits)
	Line 177:         [Editor("System.ComponentModel.Design.MultilineStringEditor", typeof(UITypeEditor))]
	Line 206:         [Editor("System.ComponentModel.Design.MultilineStringEditor", typeof(UITypeEditor))]
  ** Source\Krypton Components\Krypton.Toolkit\Controls Toolkit\KryptonDropButton.cs (1 hit)
	Line 167:         [Editor("System.ComponentModel.Design.MultilineStringEditor", typeof(UITypeEditor))]
  ** Source\Krypton Components\Krypton.Toolkit\Controls Toolkit\KryptonGroupBox.cs (1 hit)
	Line 209:         [Editor("System.ComponentModel.Design.MultilineStringEditor", typeof(UITypeEditor))]
  ** Source\Krypton Components\Krypton.Toolkit\Controls Toolkit\KryptonHeader.cs (1 hit)
	Line 172:         [Editor("System.ComponentModel.Design.MultilineStringEditor", typeof(UITypeEditor))]
  ** Source\Krypton Components\Krypton.Toolkit\Controls Toolkit\KryptonHeaderGroup.cs (1 hit)
	Line 311:         [Editor("System.ComponentModel.Design.MultilineStringEditor", typeof(UITypeEditor))]
  ** Source\Krypton Components\Krypton.Toolkit\Controls Toolkit\KryptonLabel.cs (1 hit)
	Line 139:         [Editor("System.ComponentModel.Design.MultilineStringEditor", typeof(UITypeEditor))]
  ** Source\Krypton Components\Krypton.Toolkit\Controls Toolkit\KryptonRadioButton.cs (1 hit)
	Line 206:         [Editor("System.ComponentModel.Design.MultilineStringEditor", typeof(UITypeEditor))]
  ** Source\Krypton Components\Krypton.Toolkit\Controls Toolkit\KryptonRichTextBox.cs (2 hits)
	Line 673:         [Editor("System.ComponentModel.Design.MultilineStringEditor", typeof(UITypeEditor))]
  ** Source\Krypton Components\Krypton.Toolkit\Controls Toolkit\KryptonTaskDialogCommand.cs (2 hits)
	Line 131:         [Editor("System.ComponentModel.Design.MultilineStringEditor", typeof(UITypeEditor))]
	Line 160:         [Editor("System.ComponentModel.Design.MultilineStringEditor", typeof(UITypeEditor))]
  ** Source\Krypton Components\Krypton.Toolkit\Controls Toolkit\KryptonTextBox.cs (3 hits)
	Line 711:         [Editor("System.ComponentModel.Design.MultilineStringEditor", typeof(UITypeEditor))]
  ** Source\Krypton Components\Krypton.Toolkit\Palette Base\PaletteBorder\PaletteBorder.cs (1 hit)
	Line 210:         [Editor(@"Krypton.Toolkit.PaletteDrawBordersEditor", typeof(UITypeEditor))]
  ** Source\Krypton Components\Krypton.Toolkit\Palette Component\KryptonPaletteButtonSpecTyped.cs (3 hits)
	Line 153:         [Editor("System.ComponentModel.Design.MultilineStringEditor", typeof(UITypeEditor))]
	Line 186:         [Editor("System.ComponentModel.Design.MultilineStringEditor", typeof(UITypeEditor))]
	Line 219:         [Editor("System.ComponentModel.Design.MultilineStringEditor", typeof(UITypeEditor))]
  ** Source\Krypton Components\Krypton.Toolkit\Values\ButtonValues.cs (2 hits)
	Line 171:         [Editor(@"System.ComponentModel.Design.MultilineStringEditor", typeof(UITypeEditor))]
	Line 206:         [Editor(@"System.ComponentModel.Design.MultilineStringEditor", typeof(UITypeEditor))]
  ** Source\Krypton Components\Krypton.Toolkit\Values\ColorButtonValues.cs (2 hits)
	Line 182:         [Editor(@"System.ComponentModel.Design.MultilineStringEditor", typeof(UITypeEditor))]
	Line 217:         [Editor(@"System.ComponentModel.Design.MultilineStringEditor", typeof(UITypeEditor))]
  ** Source\Krypton Components\Krypton.Toolkit\Values\HeaderValuesBase.cs (2 hits)
	Line 181:         [Editor(@"System.ComponentModel.Design.MultilineStringEditor", typeof(UITypeEditor))]
	Line 222:         [Editor(@"System.ComponentModel.Design.MultilineStringEditor", typeof(UITypeEditor))]
  ** Source\Krypton Components\Krypton.Toolkit\Values\LabelValues.cs (2 hits)
	Line 162:         [Editor("System.ComponentModel.Design.MultilineStringEditor", typeof(UITypeEditor))]
	Line 203:         [Editor("System.ComponentModel.Design.MultilineStringEditor", typeof(UITypeEditor))]
  ** Source\Krypton Components\Krypton.Workspace\Workspace\KryptonWorkspaceCollectionEditor.cs (2 hits)
	Line 183:         [Editor("System.ComponentModel.Design.MultilineStringEditor", typeof(UITypeEditor))]
	Line 195:         [Editor("System.ComponentModel.Design.MultilineStringEditor", typeof(UITypeEditor))]

giduac avatar Mar 17 '22 17:03 giduac

Hi @giduac

Thanks for this info, the only 'fixable' one might be:

** Source\Krypton Components\Krypton.Toolkit\Palette Base\PaletteBorder\PaletteBorder.cs (1 hit) Line 210: [Editor(@"Krypton.Toolkit.PaletteDrawBordersEditor", typeof(UITypeEditor))]

@Smurf-IV Is this true?

PWagner1 avatar Mar 17 '22 17:03 PWagner1

Hi @giduac

Could you possibly retest using nightly build >= .77?

PWagner1 avatar Mar 18 '22 08:03 PWagner1

@Wagnerp The fix from yesterday didn't work.

I've added the Editor line also to the items property and that seems to work. The items can be edited from the IDE now. At runtime also in net31/net48/net50/net60

You might give this a try yourself... and add it to the next Nightly??

image

giduac avatar Mar 18 '22 11:03 giduac

@Wagnerp The fix from yesterday didn't work.

I've added the Editor line also to the items property and that seems to work. The items can be edited from the IDE now. At runtime also in net31/net48/net50/net60

You might give this a try yourself... and add it to the next Nightly??

image

@giduac

Will be in tomorrows nightly build

PWagner1 avatar Mar 18 '22 16:03 PWagner1

Hi @Wagnerp,

I build the Palette Designer locally without packages and added a BreadCrumb to it. And it actually doesn't work. Here's why.

The order of the TargetFrameworks in the .csproj file dictates which toolkit.dll is active in the designer.

In this case it works in the designer.

<TargetFrameworks>net48;net5.0-windows;net6.0-windows</TargetFrameworks>

And in this order not. So the first TargetFrameworks is the one that is loaded

<TargetFrameworks>net5.0-windows;net6.0-windows;net48</TargetFrameworks>

And as soon as you create an app with NuGet packages and target anything except net48 it doesn't work. Just like building the app in the source tree

So that editor line on the items property has no effect. And the problem still exists....

giduac avatar Mar 18 '22 16:03 giduac

Hi @giduac

I think for V7 (aka 70.22.11.xx), separate packages for pre .NET Core could be on the cards, i.e. Legacy packages?

PWagner1 avatar Mar 18 '22 16:03 PWagner1

@Wagnerp But net48 is the only that works in the designer. So for the other versions a fix is still required.

giduac avatar Mar 18 '22 17:03 giduac

@Wagnerp @Smurf-IV

Been looking around a bit, and found some info. As it looks it could be connected to the WinForms Designer's for .Net3/5/6. ongoing development.

https://github.com/dotnet/winforms/issues/4304 https://developercommunity.visualstudio.com/t/net-5-winforms-designer-ignores-systemcomponentmod/1398197

giduac avatar Mar 18 '22 21:03 giduac

@Wagnerp @Smurf-IV

To test the info above I also tried it with KTreeView. Unlike with the BreadCrumb here the button to start the Nodes editor is visible.

Just like the BreadCrumb, KTreeView node editor also doesn’t work with Net3/5/6 But does with Net48.

At runtime the Nodes editor is accessible from a property-grid. Just like the BreadCrumb.

This happens when trying to edit the Nodes collection. image

giduac avatar Mar 19 '22 08:03 giduac

@Smurf-IV @Wagnerp

On KNavigator:

Like KTreeView and KBreadCrumb node editors, the KNavigator page editor is also derived from CollectionEditor. In KNavigator the Pages collection editor does work in the designer and at runtime on all .Net versions.

giduac avatar Mar 19 '22 09:03 giduac

@Smurf-IV @Wagnerp

KContextMenu

KryptonContextMenuCollectionEditor derives from CollectionEditor

Net48 works normal In Net3/5/6 Items editor can be started in the designer But as soon as one of the buttons is clicked to add an item the form closes.

At runtime all .NET versions can start the editor and edit items.

giduac avatar Mar 19 '22 09:03 giduac

A possible workaround would be to include net48 as the first framework in the <TargetFrameworks> line of the .csproj when working on a .Net3/5/6 project.

In that way the project can be edited from the designer and when compiling this goes into to the higher .Net version.

Edit: Note: That would only aid the graphical portion. Because the first framework then will also put the project in Net48 mode instead of the higher one.

giduac avatar Mar 19 '22 11:03 giduac

A possible workaround would be to include net48 as the first framework in the <TargetFrameworks> line of the .csproj when working on a .Net3/5/6 project.

In that way the project can be edited from the designer and when compiling this goes into to the higher .Net version.

Edit: Note: That would only aid the graphical portion. Because the first framework then will also put the project in Net48 mode instead of the higher one.

That would need to be done on the developers part, since the packages already contain binaries from 4.6.2 - .NET 6/7 (nightly releases)

PWagner1 avatar Mar 19 '22 15:03 PWagner1

That would need to be done on the developers part, since the packages already contain binaries from 4.6.2 - .NET 6/7 (nightly releases)

Yes a workaround on the dev's side. But it's not ideal.

The odd one out is the KNavigator pages editor. That one does work. And is derived from the same class as the others. So it could be that the incompatibility is present in the other Krypton editors objects. So it might be good to have a deeper look at that, as this tends to a possible solution.

giduac avatar Mar 19 '22 16:03 giduac

That would need to be done on the developers part, since the packages already contain binaries from 4.6.2 - .NET 6/7 (nightly releases)

Yes a workaround on the dev's side. But it's not ideal.

The odd one out is the KNavigator pages editor. That one does work. And is derived from the same class as the others. So it could be that the incompatibility is present in the other Krypton editors objects. So it might be good to have a deeper look at that, as this tends to a possible solution.

More investigation needs to be done, I don't think this can be done in the April 2022 build. But a workaround will be noted in the readme.

PWagner1 avatar Mar 20 '22 16:03 PWagner1

Also needs keeping an eye on the status of the ongoing development of the WinForms designer for the higher .NET versions. Since that might resolve (some of )this as well.

giduac avatar Mar 21 '22 07:03 giduac

Hi @Wagnerp & @Smurf-IV ,

I've been doing some more digging on this topic / the Out Of Process WinForms Designer (SDK). In the next week (probably) I will open a new discussion with findings on this topic as a central point to collect, discuss and make available information over time.....

giduac avatar Mar 26 '22 09:03 giduac

Announced discussion has been opened here: https://github.com/Krypton-Suite/Standard-Toolkit/discussions/684

giduac avatar Mar 31 '22 06:03 giduac

Trying to use net48 causes the majority of my program to break (it complains I can't use the C#8 and later features). Not sure if this is considered a great workaround.

Lone83427 avatar Dec 02 '22 03:12 Lone83427

Note: I "use" c# 11 features in my .net48 program. It is a Targetting thing to do with the compiler, not the loaded / target framework usage: image

Smurf-IV avatar Dec 02 '22 07:12 Smurf-IV