Bind SelectedColor to Rectangle inside RadColorPicker

3 posts, 0 answers
  1. Luís
    Luís avatar
    1 posts
    Member since:
    Sep 2017

    Posted 19 Sep 2017 Link to this post

    Hello Sirs,

    I'm trying to show the selectedColor/selectedItem in a rectangle which is inside my RadColorPicker.

    <Style TargetType="telerik:RadColorPicker" 
               BasedOn="{StaticResource StandardInputControlStyle}"
            <Setter Property="Margin" Value="5,0,10,5"></Setter>
            <Setter Property="ContentTemplate">
                <!-- responsible for the button's design -->
                            <Rectangle HorizontalAlignment="Center" 
                                 Fill="{Binding ElementName=colorPicker, Path=SelectedColor}">
  2. Vladimir Stoyanov
    Vladimir Stoyanov avatar
    480 posts

    Posted 20 Sep 2017 Link to this post

    Hello Luis,

    In order to bind to the SelectedColor of the RadColorPicker you can use a RelativeSource binding and set the AncestorType to be RadColorPicker. You should also implement a ValueConverter in order to convert the color into a Brush.

    Please find a simple project attached which implements this behavior.

    I hope you find this helpful. Let me know if you have any more questions.

    Vladimir Stoyanov
    Progress Telerik
    Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
  3. Luis
    Luis avatar
    15 posts
    Member since:
    Sep 2017

    Posted 25 Sep 2017 in reply to Vladimir Stoyanov Link to this post

    I really appreciate your attention, Sir.

    That helped me a lot.
Back to Top