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

6 posts, 0 answers
  1. Surendra
    Surendra avatar
    3 posts
    Member since:
    Sep 2011

    Posted 23 Sep 2011 Link to this post

    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.

     
  2. Petar Mladenov
    Admin
    Petar Mladenov avatar
    2891 posts

    Posted 28 Sep 2011 Link to this post

    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 >>

  3. UI for WPF is Visual Studio 2017 Ready
  4. Surendra
    Surendra avatar
    3 posts
    Member since:
    Sep 2011

    Posted 12 Oct 2011 Link to this post

    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();
                }
            }       
        }
    }
  5. Petar Mladenov
    Admin
    Petar Mladenov avatar
    2891 posts

    Posted 17 Oct 2011 Link to this post

    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 >>

  6. Surendra
    Surendra avatar
    3 posts
    Member since:
    Sep 2011

    Posted 19 Oct 2011 Link to this post

    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.
  7. Petar Mladenov
    Admin
    Petar Mladenov avatar
    2891 posts

    Posted 21 Oct 2011 Link to this post

    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 >>

Back to Top
UI for WPF is Visual Studio 2017 Ready