RadPickerBox PickerButtonStyle

3 posts, 0 answers
  1. Kris Kasias
    Kris Kasias avatar
    3 posts
    Member since:
    Jan 2007

    Posted 22 May 2011 Link to this post

    Hi,

    I've tried to follow along with the sample application for WP7 that comes with the installation and things were going well until I tried  to dynamically set the styles on the PickerBox Content itself.  

    I basically used the example to create a full-screen popup with 3 color swatches on it and use the same code for the selection (to deselect the other togglebuttons).  In my ApplicationBarInfo_ButtonClick I wanted to

    1. Discover which was the currently checked togglebutton
    2. Create SolidColorBrush mySwatchColorBrush = new SolidColorBrush( toggleButton.Background.Color )
    3. Set myRadPickerBox.Background = mySwatchColorBrush

    Seems I can't do this.  I've tried everything I can think of including:

    • Create a style and assign it to PickerBoxStyle as the default and then change to different styles at runtime...no go
    • Use the SetValue function....nothing

    No matter what I do I can't seem to actually set that property with any effect.

    Is this possible at runtime?

    TIA,
    KK
  2. Deyan
    Admin
    Deyan avatar
    2039 posts

    Posted 25 May 2011 Link to this post

    Hello Kris,

    Thanks for contacting us and for your interest in RadControls for Windows Phone 7.

    As you can see in the source code of the example, we actually iterate over all controls that are important and gather information about their state when the user presses the Ok button and closes the popup of the picker box. After we have gathered the information we simply apply the styles to the TextBlock used in the example.

    However, to make sure that I correctly understand your scenario and thus be able to help, I would like to kindly ask you to prepare a sample app that demonstrates your approach and send it me. You will have to open a new support ticket in order to be able to upload files.

    Thanks for your understanding and for the time taken.

    Best wishes,
    Deyan
    the Telerik team
    Let us know about your Windows Phone 7 application built with RadControls and we will help you promote it. Learn more>>
  3. DevCraft banner
  4. Vijay
    Vijay avatar
    29 posts
    Member since:
    Nov 2011

    Posted 06 Jun 2012 Link to this post

    Hello Kris Kasias,

    Please find the below sample code which describes how to add different set of styles to the picker box control. Please use sample code for an idea  and you could customize your code to develop towards the requirements.

    XAML Code:

    <telerik:RadPickerBox x:Name="radPicker1"
     Height="104"
     HorizontalAlignment="Left"
     Margin="12,298,0,0"
     VerticalAlignment="Top"
     Width="434"
     FontFamily="Verdana"
     FontSize="22"
     Content="Click to Perform Arthmetic Operation">
     <telerik:RadPickerBox.PopupContent>
     <Grid x:Name="radContentGrid">
     
     <TextBlock Height="30"
     HorizontalAlignment="Left"
     Margin="0,23,0,0"
     Name="textBlock1"
     Text="Please Enter First Number: "
     FontFamily="Verdana"
     FontSize="22"
     VerticalAlignment="Top" />
     
    <TextBlock Height="30"
     Margin="6,0,0,520"
     Name="textBlock2"
     Text="Please Enter Second Number: "
     FontFamily="Verdana"
     FontSize="22" />
     
    <TextBox Height="72"
     HorizontalAlignment="Left"
     Margin="325,84,0,0"
     Name="textBox1"
     VerticalAlignment="Top"
     Width="131" />
     
    <TextBox Height="72"
     HorizontalAlignment="Left"
     Margin="325,0,0,0"
     Name="textBox2"
     VerticalAlignment="Top"
     Width="131" />
     
    <TextBlock FontFamily="Verdana"
     FontSize="22"
     Foreground="Red"
     Height="30"
     HorizontalAlignment="Left"
     Margin="85,202,0,0"
     Name="textBlock3"
     VerticalAlignment="Top" />
     
    <Button Content="Addition"
     FontFamily="Verdana"
     FontSize="22"
     Background="Red"
     Height="72"
     HorizontalAlignment="Left"
     Margin="85,256,0,0"
     Name="button1"
     VerticalAlignment="Top"
     Width="240"
     Click="button1_Click"/>
     
    <Button Content="Subtraction"
     FontFamily="Verdana"
     FontSize="22"
     Background="Blue"
     Height="72"
     HorizontalAlignment="Left"
     Margin="85,334,0,0"
     Name="button2"
     VerticalAlignment="Top"
     Width="240"
     Click="button2_Click"/>
     
    <Button Content="Multiplication"
     FontFamily="Verdana"
     FontSize="22"
     Background="Yellow"
     Height="72"
     HorizontalAlignment="Left"
     Margin="85,412,0,0"
     Name="button3"
     VerticalAlignment="Top"
     Width="240"
     Click="button3_Click" />
     
    <Button Content="Division"
     FontFamily="Verdana"
     FontSize="22"
     Background="Green"
     Height="72"
     HorizontalAlignment="Left"
     Margin="85,490,0,0"
     Name="button4"
     VerticalAlignment="Top"
     Width="240"
     Click="button4_Click"/>
     
     <Button HorizontalAlignment="Center"
     VerticalAlignment="Bottom"
     x:Name="closeBtn"
     Content="X"
     Click="closeBtn_Click">
     
     </Button>
     
    </Grid>
     </telerik:RadPickerBox.PopupContent>
     </telerik:RadPickerBox>

    Hope this is useful.

    Thanks and Regards,
    Vijay
    MVC Corp.

Back to Top