This is a migrated thread and some comments may be shown as answers.

SelectedColor does not work anymore in ribbonview

4 Answers 85 Views
ColorPicker
This is a migrated thread and some comments may be shown as answers.
HDC
Top achievements
Rank 1
HDC asked on 12 Jun 2012, 05:27 PM

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

 

 

 

 

4 Answers, 1 is accepted

Sort by
0
Petar Mladenov
Telerik team
answered on 13 Jun 2012, 01:14 PM
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 >>

0
HDC
Top achievements
Rank 1
answered on 16 Jun 2012, 06:53 AM
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




0
Accepted
Petar Mladenov
Telerik team
answered on 20 Jun 2012, 12:43 PM
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 >>

0
HDC
Top achievements
Rank 1
answered on 11 Jul 2012, 08:16 AM
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
Tags
ColorPicker
Asked by
HDC
Top achievements
Rank 1
Answers by
Petar Mladenov
Telerik team
HDC
Top achievements
Rank 1
Share this question
or