Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / WPF > ColorPicker > The 'Automatic' option in the RadColorPicker not work as office ColorPicker.

Not answered The 'Automatic' option in the RadColorPicker not work as office ColorPicker.

Feed from this thread
  • Surendra avatar

    Posted on Sep 23, 2011 (permalink)

    I am Using RadColorPicker in our project. But RadColorPicker is not working as Office ColorPicker.

    when i am selecting ColorPicker By Default NoColorFeild Selected with Black color.
    after that i am selecting any color from Header Pallete or Standard Pallete. Color change as per selection.

    when again i am trying to select NoColorFeild or click on 'Automatic', That is not working as Office ColorPicker.

     

    Reply

  • Petar Mladenov Petar Mladenov admin's avatar

    Posted on Sep 28, 2011 (permalink)

    Hello Surendra,

     I'm not sure I understood you completely. We are aware of a bug in the ExpressionDarg theme related to the Automatic Color field. Are you using this theme ? Is it possible for you to capture a video of the incorrect behaviour of the ColorPicker ? This way we would be better able to assist you. Thank you in advance for your cooperation.

    Regards,
    Petar Mladenov
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

    Reply

  • Surendra avatar

    Posted on Oct 12, 2011 (permalink)

    Hi Petar,

    i am using below code in my project. 
    =====================================================================================================
    XAML file code
    <Window x:Class="ColorPickerAutomaticIssue.MainWindow"
            Title="MainWindow" xmlns:tel="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls"
            xmlns:telerikNavigation="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.Navigation"
             
            xmlns:dragDrop="clr-namespace:Telerik.Windows.Controls.DragDrop;assembly=Telerik.Windows.Controls"
            xmlns:telerikRibbonBar="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.RibbonBar"
            mc:Ignorable="d" d:DesignHeight="300" d:DesignWidth="300" >
        <Grid>
            <Grid.RowDefinitions>
                <RowDefinition Height="50" ></RowDefinition>
                <RowDefinition Height="*"></RowDefinition>
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*"></ColumnDefinition>
            </Grid.ColumnDefinitions>
            <telerikRibbonBar:RadOrderedWrapPanel VerticalAlignment="Top">                     
                <telerikRibbonBar:RadButtonGroup>               
                    <telerikRibbonBar:RadRibbonButton  Text="Font Color" telerikRibbonBar:ScreenTip.Title="Font Color" telerikRibbonBar:ScreenTip.Description="Change the text color.">
                        <tel1:RadColorPicker Name="rbcolor"  MainPalette="Civic" HeaderPalette="Civic" Click="foregroundColor_click" DropDownOpened="fontColor_DropDownOpened"/>
                    </telerikRibbonBar:RadRibbonButton>
                </telerikRibbonBar:RadButtonGroup>
     
     
            </telerikRibbonBar:RadOrderedWrapPanel>
            <RichTextBox Name="mainRichTextBox" Grid.Row="1" AcceptsTab="True" AcceptsReturn="True" dragDrop:RadDragAndDropManager.AllowDrop="True"
                         VerticalScrollBarVisibility="Auto" SpellCheck.IsEnabled="True" Focusable="True"
                         Background="White" Margin="2,0,0,5" KeyDown="mainRichTextBox_KeyDown"
                         TabIndex="0" ForceCursor="True" IsUndoEnabled="True" IsDocumentEnabled="True"  Loaded="mainRichTextBox_Loaded" SelectionChanged="mainRichTextBox_SelectionChanged" >
            </RichTextBox>
        </Grid>
    </Window>
    ========================================================================================================
    CS File Code

    using Telerik.Windows.Controls;
    using System.Windows.Controls.Primitives;
     
     
    namespace ColorPickerAutomaticIssue
    {  
        public partial class MainWindow : Window
        {
            private int updatingUI = 0;
     
            public MainWindow()
            {
                InitializeComponent();         
            }      
            private void mainRichTextBox_KeyDown(object sender, KeyEventArgs e)
            {            
                TextRange range = new TextRange(mainRichTextBox.Selection.Start, mainRichTextBox.Selection.End);                   
                updatingUI = 0;           
            }
            private void mainRichTextBox_SelectionChanged(object sender, RoutedEventArgs e)
            {
                TextRange selectionRange = new TextRange(mainRichTextBox.Selection.Start, mainRichTextBox.Selection.End);          
                TextPointer tp = mainRichTextBox.CaretPosition.GetInsertionPosition(LogicalDirection.Forward);
                TextRange tr = new TextRange(tp, tp);
                Run r = new Run(tr.Text);
                tr.ApplyPropertyValue(FlowDocument.FontFamilyProperty, "Arial");   
                mainRichTextBox.Focus();
            }
            private void mainRichTextBox_Loaded(object sender, RoutedEventArgs e)
            {
                TextRange range = new TextRange(mainRichTextBox.Selection.Start, mainRichTextBox.Selection.End);
                range.ApplyPropertyValue(RichTextBox.FontFamilyProperty, "Arial");                      
            }
            private void fontColor_DropDownOpened(object sender, EventArgs e)
            {
                Popup popup = this.rbcolor.ChildrenOfType<Popup>()[0];
                RadColorSelector Radselector1 = VisualTreeHelper.GetChild(popup.Child, 0) as RadColorSelector;
                Radselector1.AddHandler(RadColorPaletteViewItem.MouseLeftButtonDownEvent, new System.Windows.Input.MouseButtonEventHandler(this.FontColorSelectorItemMouseClick), true);
                Radselector1.AddHandler(RadColorPaletteViewItem.MouseMoveEvent, new System.Windows.Input.MouseEventHandler(this.FontColorSelectorItemMouseMove), true);
            }
            private void FontColorSelectorItemMouseMove(object sender, MouseEventArgs e)
            {           
                if (e.OriginalSource.GetType().FullName.Equals("System.Windows.Shapes.Rectangle"))
                {
                    if (mainRichTextBox != null)
                    {
                        if (updatingUI == 1)
                            return;
                        TextRange range = mainRichTextBox.Selection;                       
                        range.ApplyPropertyValue(TextElement.ForegroundProperty,new SolidColorBrush((Color)ColorConverter.ConvertFromString(((System.Windows.Shapes.Shape)(e.OriginalSource)).Fill.ToString())));                      
                    }
                 }
            }
            private void FontColorSelectorItemMouseClick(object sender, MouseButtonEventArgs e)
            {           
                if (mainRichTextBox != null)
                {
                    if (updatingUI == 1)
                        return;
     
                    TextRange range = mainRichTextBox.Selection;
                    range.ApplyPropertyValue(TextElement.ForegroundProperty,
                                                new SolidColorBrush((sender as RadColorSelector).SelectedColor));                   
                    mainRichTextBox.Focus();
                }
            }
            private void foregroundColor_click(object sender, EventArgs e)
            {
                if (mainRichTextBox != null)
                {
                    if (updatingUI == 1)
                        return;
                    TextRange range = mainRichTextBox.Selection;
                    range.ApplyPropertyValue(TextElement.ForegroundProperty, new SolidColorBrush((sender as RadColorPicker).SelectedColor));
                    mainRichTextBox.Focus();
                }
            }       
        }
    }

    Reply

  • Petar Mladenov Petar Mladenov admin's avatar

    Posted on Oct 17, 2011 (permalink)

    Hello Surendra,

     I prepared a video for you showing how I tested your code. Basically, I open the ColorPickers ,pick a color, then open them again and click on the AutomaticColor field. Then the selected color is black and the only difference is that the "orange" border showing the currently selected color is on the AutomaticColor is MS Word and in the Header Palette in our RadColorPicker. Is this the issue that you have encountered or we have missed something? Thank you for your cooperation.

    Greetings,
    Petar Mladenov
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

    Reply

  • Surendra avatar

    Posted on Oct 19, 2011 (permalink)

    I seen your video but some thing wrong. For the issue i have also prepared a Video , I opened the ColorPickers ,pick a color, then open them again and click on the AutomaticColor field. Then the selected color is not black (No changes in our RadColorPicker), it is before selected color with "orange" border in our RadColorPicker . and the only difference is that the "orange" border showing on black color on the AutomaticColor of MS Word. 
    This is the issue.

    Reply

  • Petar Mladenov Petar Mladenov admin's avatar

    Posted on Oct 21, 2011 (permalink)

    Hello Surendra,

     Probably this is bug in the RadColorPicker. Unfortunately, we were unable to reproduce it. Could you please check out our test project based on your XAML, try to modify it if needed and send it back to us? This will be highly appreciated and will help us in our future investigation. Thank you for your cooperation in advance.

    Greetings,
    Petar Mladenov
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

    Attached files

    Reply

Back to Top

Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / WPF > ColorPicker > The 'Automatic' option in the RadColorPicker not work as office ColorPicker.
Related resources for "The 'Automatic' option in the RadColorPicker not work as office ColorPicker."

WPF ColorPicker Features  |  Documentation  |  Demos  |  Telerik TV  |  Self-Paced Trainer  ]