开发者

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

开发者 https://www.devze.com 2023-01-19 16:35 出处:网络
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

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


I would have to see your exact xaml, but I am going to assume a couple of things, most importantly that the hyperlinkbuttons are produced by a template. If that is the case, the behavior needs to be specified in the template rather than directly in the datagrid. If you post the xaml for the page, I should be able to help you further.


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)

0

精彩评论

暂无评论...
验证码 换一张
取 消