Sticky Notes

Jul 19, 2010 at 2:04 AM
Edited Jul 19, 2010 at 2:05 AM

Hi I am trying to implement class StickyNote : Annotation.

What I have done : Imeplementing StickyNote,StickyNoteFactory.

I have a couple of Problems with the framework and other parts, and looked at all the samples, Ink and underline have some classes in the heart of the framework specific for them. That I cannot extend.

1. In StickyNote.RenderAnnotation method the following lines dont work : 

/*Use Popup control to show the text */

        popup.SetBinding(Popup.HorizontalOffsetProperty, new Binding("Left") { Mode = BindingMode.TwoWay });
        popup.SetBinding(Popup.VerticalOffsetProperty, new Binding("Top") { Mode = BindingMode.TwoWay });
HorizontalOffsetProperty and VerticalOffsetProperty are always zero.

2. How to remove a sticky Note? I have added a remove button to the StickyNote Control. 

But dont know how to access the AnnotationService or AnnotationStore to remove. And dont know how to find the StickyNote instance  in the AnnotationStore.

At the moment  AnnotationService.GetService requires an ITextContainer , which in case of StickyNote doesnt make sense.

3. When Scrolling in the DocumentViewer, or using 100%,400%,.. zooming StickyNotes dont move up and down, isnt this the frameworks responsiblity? if not how can i do this? I dont have access to scroll event.

4. How can I stop the StickyNotes from being scaled (zooming) when using the ViewModePicker, I knw that they are rendered on AnnotationRenderContext.AnnotationLayer which is different from where the actual document is rendered, so this must be possilbe.

 

 


 

Coordinator
Jul 19, 2010 at 12:42 PM
  1. The StickyNote implemenation available in v1.x wasn't finished, I need to look into why the offsets are zero.
  2. You need to make the ITextContainer instance (probably the document viewer) available to your StickyNote control. Either set it as data context or add an ITextContainer property to your StickyNote control and ensure it's assigned when instantiating the control.
  3. StickyNotes are displayed in a popup that do not participate in the scrolling process.
  4. The annotation layer is a child of the actual rendered page and does scale accordingly.


An updated StickyNote implementation sample will be made available for Document Toolkit 2

Jul 20, 2010 at 12:41 AM

I Resolved the first two issues

1.(was my mistake) The DataContext for the popup weas not set. 

popup.DataContext = this; //this in StickyNote.RenderAnnotation.

2.(was my mistake) Later I Noticed that the TextCotainer is acutally the DocumentViewer, So it made sense . StickyNoteControl.ITextContainer implemented.

For the next two items I noticed that after I scroll or scale , if I right click on the viewer the stickyNoteControls will be updated by position and scale.

Scaling for Ink and Highlight and underline makes sense, but not for stickyNotes.

I am trying to resolve the positioning problem : using this article. But would be neat, to have some features available in the framework.

Really interested to see the StickyNote in the samples.

Jul 22, 2010 at 1:41 AM
Edited Jul 22, 2010 at 7:30 AM

Hi Koen,

when do you think the sample/final release of Toolkit 2,with stickyNote annotations will be available?

I tried adding the StickyNote control directly to the Annotation layer. Scrolling works now, but the StickyNoteUserControl does not receive foucs(User cannot type or press the button).

Any Ideas? I noticed the AnnotationRenderContext.AnnotationLayer has zero zero width and height. But I dont believe this is realted to the problem.

Coordinator
Jul 22, 2010 at 12:33 PM

I have planned to work on a StickyNote implementation near the end of next week. The AnnotationLayer is just a canvas with no width or height set, it probably is indeed not related.

Jul 30, 2010 at 5:39 AM

I added the StickyNoteControl instance to the context.Page, I know this is the wrong place to add to but at least it responds to user input.

Then in the StickyNote.RenderAnnotation I had to check to see if the control is already added.

Now, very curious to see kozw implementation!

 

Coordinator
Aug 3, 2010 at 4:33 PM

Kavehsh,

A complete StickyNote implementation is now available. While implementing I ran into some issues in Document Toolkit itself, so there's also a new Document Toolkit release available. The sticky note implementation uses 2 new features;

  • The AnnotationRenderContext now exposes the AnnotationStore property that provide direct access to all annotations
  • A new annotations adorner layer has been created that is suitable for annotations that should be on top of all other annotation and selection visuals (as is the case with Sticky Notes)

Finally; there was a bug in Document Toolkit that prevented input controls such as textboxes to work properly. This bug is fixed now. 

Note: The latest Document Toolkit Extensions release requires Document Toolkit 2.0.0.4

Aug 4, 2010 at 6:57 AM

Fantastic work, Tx