Persistent palettes

Developer
Jan 9, 2011 at 10:18 PM

Objo,

Not sure if you get notified when patches are added, but I've uploaded #7997 for persistent palettes.

// Per

Coordinator
Jan 10, 2011 at 6:10 AM
Edited Jan 10, 2011 at 6:14 AM

hi Per,

yes, I noticed the patch - great work!! I will have a look at it and check it in soon!

I have not found a solution to the bug with opening/closing of the colorpicker popup yet, this problem has been added to the Issue Tracker. I hope someone who knows more about WPF can have a look!

Jan 10, 2011 at 4:22 PM

Here's some code that I was using for a color picker and a visibility picker:

        <ObjectDataProvider 
            MethodName="GetValues" 
            ObjectType="{x:Type sys:Enum}" 
            x:Key="VisibilityValues">
            <ObjectDataProvider.MethodParameters>
                <x:Type TypeName="Visibility" />
            </ObjectDataProvider.MethodParameters>
        </ObjectDataProvider>
        <ObjectDataProvider 
            MethodName="GetType" 
            ObjectType="{x:Type sys:Type}" 
            x:Key="colorsTypeOdp">
                <ObjectDataProvider.MethodParameters>
                    <sys:String>System.Windows.Media.Colors, PresentationCore,
                    Version=4.0.0.0, Culture=neutral, 
                    PublicKeyToken=31bf3856ad364e35</sys:String>
                </ObjectDataProvider.MethodParameters>
        </ObjectDataProvider>
        <ObjectDataProvider 
            ObjectInstance="{StaticResource colorsTypeOdp}"  
            MethodName="GetProperties" 
            x:Key="colorPropertiesOdp">
        </ObjectDataProvider>

                <ComboBox 
                    Grid.Column="1" 
                    HorizontalAlignment="Stretch" 
                    ItemsSource="{Binding Source={StaticResource VisibilityValues}}"
                    SelectedItem="{Binding Path=ShowTitle}"
                    Name="comboBoxTitleVisibility" 
                    VerticalAlignment="Center" />

                <ComboBox  
                    Name="comboBoxColorFg" 
                    Grid.Column="1" 
                    Margin="2" 
                    VerticalAlignment="Center" 
                    HorizontalAlignment="Stretch" 
                    SelectedValuePath="Name"
                    ContextMenu="{StaticResource popupMenu}"
                    ItemTemplate="{StaticResource ColorDataTemplate}"
                    ItemsSource="{Binding Source={StaticResource colorPropertiesOdp}}" 
                    SelectedValue="{Binding Path=IndicatorFg, Converter={StaticResource ColorBrushNameConverter}}" />

Cheers,

Bill

Coordinator
Jan 13, 2011 at 7:34 AM
Edited Jan 13, 2011 at 7:38 AM

hi Per, I am currently looking at the patch.

I would like to have the persistent palette a bit more compact.. Maybe info in a tooltip and icons on the load/save buttons. Could drag/drop make it even simpler than using the ctrl/shift/alt key combinations?

I think the left TabStripPlacement steals a lot of horizontal space for the color controls, I want it at the bottom as default. I have added a TabStripPlacement property to the ColorPicker to control this.

I hope we can find a better solution than the Apply button next to the hex textbox, maybe implement it as the red/green/blue textboxes?

Bill: I don't think the code you inlined helps the colorpicker. Thanks anyway for sharing!

Developer
Jan 13, 2011 at 6:06 PM

Feel free to improve upon my code. If you can make it more compact and still keep the palettes separate it's a good thing.

If you place the TabStrips at the bottom you end up with the PopUp closing when you click on a tab that is vertically smaller than the currently displayed tab.

R/G/B boxes would be an improvement over the apply button, as long as they are using the PopertyChanged setting for their binding.

Developer
Jan 17, 2011 at 9:22 PM

Objo, do you have some code that you can commit regarding this feature? I'd like to get this feature to a more finished state and don't want to do the same work as you, in case you've already done some parts.

Coordinator
Jan 19, 2011 at 7:33 AM

hi Per, I need a bit more time to finish what I started - I don't want to submit half-finished code. I added a property to change the position of the tabs and I will get rid of the apply button next to the hex textbox. As I mentioned in the previous post it would also be nice to use drag/drop instead of the ctrl/shift/alt keys to add to the user palette. 

Developer
Jan 19, 2011 at 11:03 AM

Ok, I can wait for that.

Drag n' drop is a nice feature, but isn't really a requirement - at least not for me or my users. Nor do I feel it as a intuitive way of doing it. Looking at other palettes I've seen in other application, they are all click-based.

An alternative to both the keys and drag n' drop is using the second button on the mouse, such as:

Right-click in fixed palette/color box: Add to persistent palette
Right-click in persistent palette: Update clicked color with the one currently in the color box.
Shift-right-click in persistent palette: Remove color.

Should be easier to implement, imho, but I'm no WPF-guru...

Coordinator
Jan 27, 2011 at 5:36 AM

hi Per! The recent changes look very good! There is just a little binding bug in the "CurrentStore" text field that breaks the .net 3.5 solution. I commented it out. Can you fix it?

Developer
Jan 27, 2011 at 6:33 PM

Done.