POPUP FOR A DATAGRID

Last post 07-29-2009 12:59 AM by prateek1. 1 replies.

Sort Posts:

  • POPUP FOR A DATAGRID

    07-28-2009, 1:16 PM
    • Member
      11 point Member
    • Manasa_12
    • Member since 07-14-2009, 10:18 PM
    • Posts 14

    Hey,


    I am building a silverlight application project that has a datagrid (which I populated by joining tables in my SQL).

    My question) - For each of the rows in my DATAGRID when selected, I have to generate a popup that has data grabbed from another table in SQL.How do I write code to bring up the popup for each row in my datagrid ?? .


    Thanks for any help!

    Manasa

  • Re: POPUP FOR A DATAGRID

    07-29-2009, 12:59 AM
    • Member
      240 point Member
    • prateek1
    • Member since 07-01-2009, 7:52 AM
    • Posts 47

    Hi,

    Here is the code XAML :

    first create stack  pannel and set that visiblity = collapsed :


      <StackPanel Visibility="Collapsed"
      x:Name="edittextbox"
      Opacity="0.95"
      Background="#FF95986A" Height="392.13" Width="624" Canvas.Left="206" Canvas.Top="118.87">
      <Grid>
      <Rectangle Canvas.Left="214" Canvas.Top="288" Stroke="#FFFFFFFF" StrokeThickness="1" RadiusX="17" RadiusY="36" Opacity="1" Fill="#FF87884C" d:LayoutOverrides="VerticalAlignment, GridBox" Margin="120,120.467,126,-271.467" />
       
      <TextBlock HorizontalAlignment="Left" VerticalAlignment="Bottom" Text="Edit Group Name" TextWrapping="Wrap" x:Name="edit" RenderTransformOrigin="0.5,0.5" FontSize="16" Width="148" TextAlignment="Center" Canvas.Top="169.727" Canvas.Left="-63.028" Margin="-59,0,0,-30.697" d:LayoutOverrides="Height">  
      <TextBlock.RenderTransform>
      <TransformGroup>
      <ScaleTransform/>
      <SkewTransform/>
      <RotateTransform/>
      <TranslateTransform X="297" Y="128"/>
      </TransformGroup>
      </TextBlock.RenderTransform>
      </TextBlock>  
      <TextBox Text="" TextWrapping="Wrap" Width="168" x:Name="editname" HorizontalAlignment="Left" VerticalAlignment="Bottom" RenderTransformOrigin="0.5,0.5" HorizontalScrollBarVisibility="Auto" IsReadOnly="False" VerticalScrollBarVisibility="Disabled" AcceptsReturn="False" Visibility="Visible" UseLayoutRounding="True" d:IsStaticText="False" IsHitTestVisible="True" FontFamily="Portable User Interface" Canvas.ZIndex="0" ScrollViewer.VerticalScrollBarVisibility="Disabled" VerticalContentAlignment="Center" Canvas.Top="169" Canvas.Left="-97" d:LayoutOverrides="HorizontalAlignment, Height" Margin="-231,0,0,-72">
      <TextBox.Background>
      <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
      <GradientStop Color="#FFF9F4F4"/>
      <GradientStop Color="#FFFFFFFF" Offset="1"/>
      </LinearGradientBrush>
      </TextBox.Background>
      <TextBox.RenderTransform>
      <TransformGroup>
      <ScaleTransform/>
      <SkewTransform/>
      <RotateTransform/>
      <TranslateTransform X="458" Y="128"/>
      </TransformGroup>
      </TextBox.RenderTransform>
      </TextBox>  
      <Button Content="Save Me !" Canvas.Top="298.606" Canvas.Left="708.955" x:Name="Edit" d:LayoutOverrides="VerticalAlignment, Height" Margin="210,0,0,-253.327" VerticalAlignment="Bottom" Width="88" HorizontalAlignment="Left"/>
      <Button Content="Cancel !" Canvas.Top="298.606" Canvas.Left="708.955" x:Name="Cancel" d:LayoutOverrides="VerticalAlignment, Height" Margin="0,0,206,-253" VerticalAlignment="Bottom" Width="88" HorizontalAlignment="Right"/>
      </Grid>  
      </StackPanel>


    now on XAMl.Cs side we fire event

    gridname.PreparingCellForEdit +=new EventHandler<DataGridPreparingCellForEditEventArgs>(gridname_PreparingCellForEdit);


    then:

    void gridname_PreparingCellForEdit(object sender, DataGridPreparingCellForEditEventArgs e)
      {

      edittextbox.Visibility = Visibility.Visible;
     
      }

     I hope this work you because it work fine for me in my project

    mark as answer


    Regard

    Prateek 

     


    Regard

    Prateek Bhatnagar (BCA & MCA)

    Prateek'Tips


    www.msdotnetheaven.com

Page 1 of 1 (2 items)