Click here to Skip to main content
15,885,435 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
This is my XAML page
XML
<data:DataGridTemplateColumn Width="*">
	<data:DataGridTemplateColumn.CellTemplate>
		<DataTemplate>
			<Border  BorderThickness="0"
					 BorderBrush="Gray"
					 Height="Auto">
				<Grid Margin="0,0,0,20">
					<Grid.ColumnDefinitions>
						<ColumnDefinition Width="0" />
						<ColumnDefinition Width="*" />
						<ColumnDefinition Width="Auto"
										  MaxWidth="60" />
					</Grid.ColumnDefinitions>

					<Grid.RowDefinitions>
						<RowDefinition Height="Auto" />
					</Grid.RowDefinitions>

					<HyperLinkButton F>
						<Grid x:Name="grdFAQs"
							  Horiz>
							<Grid.ColumnDefinitions>
								<ColumnDefinition Width="10" />
								<ColumnDefinition Width="*" />
							</Grid.ColumnDefinitions>
							<Grid.RowDefinitions>
								<RowDefinition Height="20" />
								<RowDefinition Height="20" />
								<RowDefinition Height="Auto" />
							</Grid.RowDefinitions>
							<TextBlock x:Name="txtbAutogeneratedID"
									   Visibility="Collapsed" />
							<Image Source="../Images/Minimize1.png"
								   Margin="0,0,4,0"
								   Tag="Mininmum"
								   Visibility="Collapsed"
								   Grid.Row="0"
								   Grid.Column="0"
								   x:Name="imgminimize"
								   Height="10"
								   Width="10"
								   VerticalAlignment="Center"
								   ToolTipService.ToolTip="{Binding minimise,Source={StaticResource resourceFile}}"
								   Horiz/>
							<Image Source="../Images/add1.png"
								   x:Name="imgmaxmize"
								   Height="10"
								   Width="10"
								   Grid.Row="0"
								   Grid.Column="0"
								   Margin="0,0,0,0"
								   ToolTipService.ToolTip="{Binding maximise,Source={StaticResource resourceFile}}"
								   VerticalAlignment="Center"
								   Horiz/>

							<TextBlock Margin="3,0,0,0"
									   Horiz/>

							<TextBlock Margin="3,0,0,0"
									   Horiz/>

							<TextBlock  Text="{Binding FAQ_ANSWER}"
										Visibility="Collapsed"
										TextWrapping="Wrap"
										x:Name="txtAnswer"
										Margin="3,10,0,0"
										VerticalAlignment="Top"
										Foreground='Black'
										Style='{StaticResource TitleStyle2}'
										Horiz/>

						</Grid>

					</HyperLinkButton>


					<StackPanel Orientation="Horizontal"
								Grid.Row="0"
								Grid.Column="2"
								Margin="0,3,0,0">

						<HyperLinkButton  Height="20"
								          Margin="0,0,0,0"
								          Horiz>
							<Image  Source="../Images/documents_folder-48.png"
									Height="22"
									Width="18" />
						</HyperLinkButton>
						<HyperLinkButton Height="20"
                                         Horiz>
							<Image  Source="../Images/video.png"
									Margin="8,0,0,0"
									Height="40"
									Width="30" />
						</HyperLinkButton>
						<HyperLinkButton Height="30"
                                         Horiz>
							<Image  Source="../Images/appbar.link.png"
									Margin="2,0,0,0"
									Height="50"
									Width="30" />
						</HyperLinkButton>

					</StackPanel>

				</Grid>
			</Border>
		</DataTemplate>
	</data:DataGridTemplateColumn.CellTemplate>
</data:DataGridTemplateColumn>


And the code behind
C#
public void hlnkbtnminimize_Click(object sender, RoutedEventArgs e)
{
    var ctr = e.OriginalSource as HyperlinkButton;
    DependencyObject dep = (DependencyObject)e.OriginalSource;
    if (ctr != null)
    {
        Image objminImg = (Image)(ctr.FindName("imgminimize"));
        Image objmaxImg = (Image)(ctr.FindName("imgmaxmize"));
        TextBlock objAnswer = (TextBlock)(ctr.FindName("txtAnswer"));
        TextBlock objSerialNo = (TextBlock)(ctr.FindName("txtbAutogeneratedID"));
        objAutogeneratedSerialNo =Convert.ToInt32(objSerialNo.Text);
        int serialNo = (objAutogeneratedSerialNo) ;
        objchk=Convert.ToString(ctr.Tag);
        if (objminImg.Visibility == Visibility.Visible)
        {
            //  GVMarketList.RowHeight= 30;
                //  ctr.Height = 40;
                //objAnswer.Height = 0;

                objminImg.Visibility = Visibility.Collapsed;
                objmaxImg.Visibility = Visibility.Visible;
                // objAnswer.Visibility = Visibility.Collapsed;
                DataGridRow row = (DataGridRow)dep;
                row.DetailsVisibility = Visibility.Collapsed;
                if (objAutogeneratedSerialNo == serialNo)
                {
                    GVMarketList.RowDetailsVisibilityMode = DataGridRowDetailsVisibilityMode.Collapsed;
                }
        }
        else
        {
            GVMarketList.RowHeight = double.NaN;
            objAnswer.Height = double.NaN;
            objmaxImg.Visibility = Visibility.Collapsed;
            objminImg.Visibility = Visibility.Visible;
            objAnswer.Visibility = Visibility.Visible;
                       
            //stkpnlvideo.Visibility = Visibility.Visible;
                         
        }
    }
}


I tried with everthing but not able to collapse the height of the row when collpasing the content in it.

You can Find the image links here
http://imagebin.ca/v/1bI9yobAzd4E[^]

[^]


Any help plz....
Posted
Updated 22-Sep-14 23:01pm
v4

1 solution

Did you try this?
C#
row.Height = 0;
 
Share this answer
 
Comments
Usha Sanjee 23-Sep-14 7:37am    
Yes. But It didn't worked out.
Olivier Levrey 23-Sep-14 8:12am    
Well it should. Are you sure you are pointing to the right row? Make this simple test: give a name to a row in the xaml (with x:Name="...") and set its height to 0 in code behind.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900