SelectedColor does not work anymore in ribbonview

5 posts, 1 answers
  1. HDC
    HDC avatar
    214 posts
    Member since:
    Dec 2010

    Posted 12 Jun 2012 Link to this post

    Hi,

    I have just deployed 2012 Q2, i have a ColorPicker within a RadRibbonView, the picker does not show the selected color anymore when i bind it to my viewmodel. But even setting it to a hardcoded color does not work anymore:

     

    <telerikRibbon:RadButtonGroup>
                    <telerik:RadColorPicker x:Name="TextColor" ColorButtonStyle="{StaticResource ColorButtonStyleA}" 
                            SelectedColor="{Binding Path=ActiveMainViewModel.PropertyGridItem.TextColor, 
    Mode=TwoWay}" Height="22" Width="32" IsEnabled="False"                                
                      telerik:ScreenTip.Title="{Binding StringViewResources.LocalizationResources.TextColor}"
                      telerik:ScreenTip.Description="{Binding StringViewResources.LocalizationResources.TextColorDescription}"                  
                                    />
                    <telerik:RadColorPicker x:Name="BackColor" ColorButtonStyle="{StaticResource ColorButtonStyle}"
                                            SelectedColor="Red"
                                            Height="22" Width="32" IsEnabled="False"                               
                      telerik:ScreenTip.Title="{Binding StringViewResources.LocalizationResources.BackColor}"
                      telerik:ScreenTip.Description="{Binding StringViewResources.LocalizationResources.BackColorDescription}"                  
                                    />
                </telerikRibbon:RadButtonGroup>

     

    Has something been changed to this control in 2012 Q2, i couldn't find anything on the release notes?

    Best Regards,

    Peter

     

     

     

     

  2. Petar Mladenov
    Admin
    Petar Mladenov avatar
    2891 posts

    Posted 13 Jun 2012 Link to this post

    Hi Peter,

     You are right. There are changes in Q2 2012, the RadColorPicker's style is refactored and this will be reflected in the Changes and BackwardsCompatibility section in the control's online help. Unfortunately, it will be uploaded till the end of this week.
    However, I see that you have custom style. This makes me think that in this style you are using something like Rectangle, whose Fill is "TemplateBound" to the Backгround of the Button (the left part of the ColorPicker). In Q2 2012 the ColorPicker is now SplitButton and selected color is now bound via relative binding, not with templatebinding to background.
    In other words if you have:

    <Rectangle Fill="{TemplateBinding Background}"
                                          VerticalAlignment="Stretch"
                                          HorizontalAlignment="Stretch"/>
    in the ColorButtonStyle, please  replace it with:
    <Rectangle                                    
                                            VerticalAlignment="Stretch" HorizontalAlignment="Stretch">
                                        <Rectangle.Fill>
                                            <SolidColorBrush
                                                    Color="{Binding RelativeSource={RelativeSource AncestorType=telerik:RadColorPicker}, Path=SelectedColor}" />
                                        </Rectangle.Fill>
                                    </Rectangle>
    If this does not help, please send us your custom styles and we will help you upgrade. We know that upgrading might not be pleasant but this re-factoring removed known bugs related to the animations and the Popup used in the RadColorPicker. Thank you for your understanding. 

    Kind regards,
    Petar Mladenov
    the Telerik team

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

  3. DevCraft banner
  4. HDC
    HDC avatar
    214 posts
    Member since:
    Dec 2010

    Posted 16 Jun 2012 Link to this post

    Hi Petar,

    It seems this solution causes a WSOD on our application.

    This is our style at current:
    <Style x:Key="ColorButtonStyleA" TargetType="Button">
      <Setter Property="Template">
        <Setter.Value>
          <ControlTemplate TargetType="Button">
            <Grid Height="28" Width="23">
     
              <Border x:Name="BackgroundGradient" BorderThickness="1"
                                          Background="Transparent">
                <Grid>
                  <Grid.RowDefinitions>
                    <RowDefinition Height="0.674*"></RowDefinition>
                    <RowDefinition Height="0.326*"></RowDefinition>
                  </Grid.RowDefinitions>
                  <Image Width="20" Height="20" Source="{StaticResource A_16}"/>
                  <Rectangle Width="16" Fill="{TemplateBinding Background}" Height="4.232" Grid.Row="1" VerticalAlignment="Top"></Rectangle>
                  </Grid>
              </Border>
            </Grid>
          </ControlTemplate>
        </Setter.Value>
      </Setter>
      <Setter Property="Background" Value="Black" />
    </Style>

    And this is the new one:
    <Style x:Key="ColorButtonStyleA" TargetType="Button">
      <Setter Property="Template">
        <Setter.Value>
          <ControlTemplate TargetType="Button">
            <Grid Height="28" Width="23">
     
              <Border x:Name="BackgroundGradient" BorderThickness="1"
                                          Background="Transparent">
                <Grid>
                  <Grid.RowDefinitions>
                    <RowDefinition Height="0.674*"></RowDefinition>
                    <RowDefinition Height="0.326*"></RowDefinition>
                  </Grid.RowDefinitions>
                  <Image Width="20" Height="20" Source="{StaticResource A_16}"/>
                  <Rectangle VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Height="4.232" Grid.Row="1">
                          <Rectangle.Fill>
                              <SolidColorBrush
                                  Color="{Binding RelativeSource={RelativeSource AncestorType=telerik:RadColorPicker}, Path=SelectedColor}" />
                          </Rectangle.Fill>
                      </Rectangle>
                  </Grid>
              </Border>
            </Grid>
          </ControlTemplate>
        </Setter.Value>
      </Setter>
      <Setter Property="Background" Value="Black" />
    </Style>

    As soon as the page is loaded, it locks up and i get a WSOD.

    What am i doing wrong here?

    Best Regards,

    Peter




  5. Answer
    Petar Mladenov
    Admin
    Petar Mladenov avatar
    2891 posts

    Posted 20 Jun 2012 Link to this post

    Hi Peter,

     I cannot see anything unusual here. However you can change the TargetType of the Style from "Button" to "RadButton". If this does not help, is it possible for you to isolate your issue in a runnable sample and open a new support thread (24 hours response time) with a project attached. This way we would be better able to advice you.

    All the best,
    Petar Mladenov
    the Telerik team

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

  6. HDC
    HDC avatar
    214 posts
    Member since:
    Dec 2010

    Posted 11 Jul 2012 Link to this post

    Hi Petar,

    I'm sorry for the delayed response, it has been unusually busy for me the last couple of weeks.

    Using a RadButton was the solution here

    Thanks a lot for the support!

    Best Regards,

    Peter
Back to Top
DevCraft banner