{RESOLVED} Issue with UITypeEditor in 2005
I created my own user control. One of the properties uses the UITypeEditor to edit the property in the ide. But for some reason when I build the project it usually doesn't update any changes I have done to the property page.
So I have a class that inherits the UITypeEditor. It overrides the getEditStyle and the EditValue functions. If I add a messagebox to the editvalue and then build it doesn't come up. Sometimes if I close my solution, reopen it and rebuild it the messagebox will start poping up. But then when I remove it and rebuild. It keeps poping up. But if I change something on the usercontrol, like add a label that change is always present.
So it doesn't seem to be building the entire solution when I tell it to. Has anyone run into something similar?
Thanks
Re: Issue with UITypeEditor in 2005
Do you have your test project as part of the Solution? Did you add the test project as the program to start when debugging? When you show your UITypeEditor is it a Modal Form, Dropdown List, or Color Picker, etc.?
Re: Issue with UITypeEditor in 2005
Yes the test project is part of the same solution. Yes the test project has been set to start when debugging. The UITypeEditor is a modal form.
Re: Issue with UITypeEditor in 2005
Ok, so where is this messagebox supposed to show? While the Form is being displayed or after its dismissed? When you build your solution you could try "Rebuild Solution" instead of just "Build Solution".
Re: Issue with UITypeEditor in 2005
I have tried rebuild solution, and even clean, which appears to delete what's inside the bin folder.
I've been adding the messagebox just to test to see if it is updating. I put it as the very first thing in the editvalue function. So it should pop up as the very first thing. And if I can actually manage to get it to build (which is random) this messagebox displays. But say the messagebox says "1" if I change it to say "2" and rebuild it will keep saying "1". Even if I close the solution reopen and rebuild. It doesn't matter if I build each propject seporatly.
Re: Issue with UITypeEditor in 2005
I have also tried having the copy dll property set to true and false. Doesn't matter each way. I have also deleted the reference in the test app and rereferenced it. Didn't do anything.
Re: Issue with UITypeEditor in 2005
Can you post your editvalue function?
Re: Issue with UITypeEditor in 2005
VB Code:
Public Overloads Overrides Function EditValue(ByVal context As System.ComponentModel.ITypeDescriptorContext, _
ByVal provider As System.IServiceProvider, ByVal Value As Object) As Object
Dim the_setting As MainTitleCollection
Dim dlg As New frmMainTitleProperty
Dim dlgResults As New DialogResult
MessageBox.Show("test") ' I have added this for testing. At this point it doesnt show.
Try 'dont mind this its not staying just hard to debug when I dont know if it is building or not.
dlg.members = CType(Value, MainTitleCollection)
Catch
End Try
' Display the editor form.
If dlg.ShowDialog() = DialogResult.OK Then
' The user clicked OK. Use the new value.
If dlg.members Is Nothing OrElse dlg.members.Count = 0 Then
the_setting = Nothing
Else
the_setting = dlg.members
End If
Else
the_setting = CType(Value, MainTitleCollection)
End If
Return the_setting
End Function
End Class
Re: Issue with UITypeEditor in 2005
If you would like to take a look at the entire project here it is.
The class that inherits the typeEditor is called MenuItemsEditor. It in theCollections.vb
it opens up the form frmMainTitleProperty.vb. To see the problem just add a messagebox as the first line in the EditValue function, or add a label to the frmMainTitleProperty form. Then rebuild. It shows up I would almost bet money that if you remove what ever you added, and build again it will still be there.
Re: Issue with UITypeEditor in 2005
It looks like your not showing your form via the IWindowsFormsEditorService. This could be causing an issue when your creating new instances of your form and collection.
This is an example of some code from one of my usercontrols. I am passing in a collection class to edit in the frmConfiguration. It shows as the elipisis button for my Collection property.
VB Code:
Imports System.Windows.Forms.Design
'...
<System.Security.Permissions.PermissionSetAttribute(System.Security.Permissions.SecurityAction.Demand, Name:="FullTrust")> _
Friend Class NavPanelTypeEditor
Inherits UITypeEditor
Public Overloads Overrides Function EditValue(ByVal context As System.ComponentModel.ITypeDescriptorContext, ByVal provider As System.IServiceProvider, ByVal value As Object) As Object
'Attempts to obtain an IWindowsFormsEditorService.
Dim edSvc As IWindowsFormsEditorService = CType(provider.GetService(GetType(IWindowsFormsEditorService)), IWindowsFormsEditorService)
If edSvc Is Nothing Then
Return Nothing
End If
'Displays a Custom Editor Form for editing the Collection
Dim form As New frmConfiguration(DirectCast(value, clsCollection))
If edSvc.ShowDialog(form) = DialogResult.OK Then
Return value
End If
'If OK was not pressed, return the original value
Return value
End Function
Public Overloads Overrides Function GetEditStyle(ByVal context As System.ComponentModel.ITypeDescriptorContext) As System.Drawing.Design.UITypeEditorEditStyle
' Indicates that this editor can display a Form-based interface.
Return UITypeEditorEditStyle.Modal
End Function
End Class
Re: Issue with UITypeEditor in 2005
Changing that seems to have partly worked. Now the dll does update the class and property form every time I restart the app. I'm starting to think this might be a bug. There doesn't seem to be any reason why the Class NavPanelTypeEditor wouldn't update after a build when the control itself does.
Do you have any other ideas as what it could be?
Re: Issue with UITypeEditor in 2005
Just thought I would give an update:
I posted a bug report on MSDN about this after not being able to figure this out with RobDogg's help and help on an MSDN forum. Microsoft was able to confirm the issue and they are working on a solution as of 12-6.
I'll post the solution once I get it.
Re: Issue with UITypeEditor in 2005
Cool, but I can only assume that the bug is just in 2005 only?
Re: Issue with UITypeEditor in 2005
I just got a response from MS yesterday. This is a bug in 05 and there will be a fix for it in the next update (whenever that will be).
Thanks for all your help.