Search code examples
datagridsketchflow

How to set a State when clicking on a cell in a DataGrid


While working on my Silverlight4 SketchFlow prototype I have a datagrid that has a column of hyperlinkbuttons. I would like to set a State when one of these buttons is clicked. It doesn't appear that the controls inside the datagrid are exposed to drop a behavior on them. Is there any way to do this? Essentially, I am trying to set a State so I can add a window to display detail data from the selected row. Maybe there is a better way to tackle this problem in SketchFlow?

thanks!

Bill Campbell


Solution

  • here is my xaml

                        <data:DataGridTemplateColumn x:Name="stops" Header="Stop" Width="60" CanUserSort="True" IsReadOnly="True">
                            <data:DataGridTemplateColumn.CellTemplate>
                                <DataTemplate>
                                    <HyperlinkButton x:Name="Stops" Content="{Binding stop, Mode=OneWay}" Style="{StaticResource PageHyperlinkButtonStyle}" HorizontalAlignment="Left" >
                                        <i:Interaction.Triggers>
                                            <i:EventTrigger EventName="Click">
                                                <pb:ActivateStateAction TargetState="ShowStops"/>
                                            </i:EventTrigger>
                                        </i:Interaction.Triggers>
                                    </HyperlinkButton>
                                </DataTemplate>
                            </data:DataGridTemplateColumn.CellTemplate>
                        </data:DataGridTemplateColumn>              
    

    This doesn't seem to do what I want. I want to be able to click on the Hyperlink button and set the State to ShowStops.

    I have been looking for a tutorial or something that explains how to do this but haven't had any luck so far. I'd like to also pass the stop id as well (just a piece of data).

    thanks! Bill Campbell (Bill44077)