tags:

views:

23

answers:

1

I have a custom component, ExportCommandButton, that has two attached properties. This component is designed to be attached to a button. When clicked, the component would initiate the export method of the grid (Telerik RadGridView). The problem I have is how can I pass the grid to the component via one of the attached properties? I've tried element to element binding, but the GridView set property never fires. How do you bind to a control and not a property of the control?

<Button IsEnabled="{Binding Loaded}" 
       cmd:ExportCommandButton.GridView="{Binding ElementName=MyGrid}" 
       cmd:ExportCommandButton.Converter="{StaticResource MyConverter}">
      <Button.Content>
       <StackPanel Orientation="Horizontal">
          <Image Source="/Assets/xls.png" />
          <TextBlock VerticalAlignment="Center" Text="Export" Margin="5,0,0,0" />
       </StackPanel>
      </Button.Content>
</Button>
A: 

Your syntax seems right. The CLR property setter is not called because the binding directly updates the dependency property, without passing by the property which is here for convenience. Use the propertyChangedCallback parameter of your attached property metadata to listen for changes.

Julien Lebosquain
Thanks! That worked!
Mike C