I thought this one was going to be easy. Sure, instantiating an HTMLEditor control and passing it off as the graphic in the ListCell does the trick. When the user does some text formatting is where the problems lie.

Once editing in the ListView is activated, try clicking on any formatting buttons of the HTMLEditor and you will find out that nothing happens. You cannot even see the buttons getting clicked. Once you click on them, it looks like the focus is lost as the toolbar gets a shaded effect like its focus is lost.

This was a pain but I found out later on that the EventHandlers in those buttons act like somehow they had been removed.

What I did was to get references to the toolbars of the HTMLEditor, loop through each toolbar button and add an EventHandler.

Check out this code.

Notice that instead of using .tool-bar for the lookup keyword, ToolBar is used. The toolbars in the HTMLEditor are made up of 2 toolbars so getting a reference to those 2 is very important so we can add an EventHandler to each of the toolbar buttons.

I also included an if statement that only adds the EventHandler if the child node encountered is a class that is of the Button type.

There. By adding that code, when you use an HTMLEditor control as a control representing part of a ListCell graphic, the buttons in those toolbars should work the way they are supposed to when mouse clicked.

Related Posts Plugin for WordPress, Blogger...