Binding issue with Custom Control inside RibbonLabel

Nov 21, 2008 at 4:59 PM
Ok so here is my problem, the first set of code below binds the value of the slider to the textbox text value and has been tested to work without any problems...until I try and insert it into the ribbon that is. When I embed the code into the ribbon (using a RibbonLabel) the binding ceases to work. Am I missing something obvious or am I doing something wrong?  

------------------------------- First set
<
Grid>
    <Grid.RowDefinitions>
        <RowDefinition Height="30"/>
        <RowDefinition />
    </Grid.RowDefinitions>
    <TextBox x:Name="CurrentZoomLevel" 
        Grid.Column="0" Grid.Row="0" HorizontalAlignment="Center" VerticalAlignment="Center" Width="100" 
        Text
="{Binding ElementName=ZoomSlider, Path=Value}"/>
    <Slider Grid.Column="0" Grid.Row="1" x:Name="ZoomSlider" Minimum="1" Maximum="500"  Value="100"  LargeChange="10"/>
</Grid>

 

 

------------------------------- Second set
<
r:RibbonGroup GroupSizeDefinitions="{StaticResource _1RibbonLayout}">
    <r:RibbonGroup.Command>
        <r:RibbonCommand LabelTitle="Zoom" SmallImageSource="Resources/Images/Search.ico" />
    </r:RibbonGroup.Command>
 <r:RibbonLabel>
    <Grid>
        <Grid.RowDefinitions
>
            <RowDefinition Height
="30"/>
            <RowDefinition
/>
        </Grid.RowDefinitions
>
        <TextBox x:Name="CurrentZoomLevel" 
            Grid.Column="0" Grid.Row="0" HorizontalAlignment="Center" VerticalAlignment="Center" Width="100" 

            Text
="{Binding ElementName=ZoomSlider, Path=Value}"/>
        <Slider Grid.Column="0" Grid.Row="1" x:Name="ZoomSlider" Minimum="1" Maximum="500"  Value="100"  LargeChange
="10"/>
    </Grid
 </r:RibbonLabel>

 

Nov 25, 2008 at 7:24 AM
You're absolutely correct, you're hitting another known issue that will be addressed in our V1 release, thanks for reporting it.  For now, as a workaround, you should be able to achieve the same behavior using events.  Set the TextBox element's Name property, then in your Slider's ValueChanged callback, set the Text property of your TextBox.  I realize this isn't ideal, and can assure you that this will be fixed in V1.

Thanks again for reporting issues with the CTP!
-Mike