折叠时在扩展器中设置内容控件的最小宽度

时间:2014-07-28 01:47:47

标签: c# silverlight xaml silverlight-4.0

我有一个带有扩展器的pdfViewer。我试图在折叠到250时设置扩展器内部控件的最小高度,并在展开时将高度设置为页面高度。 因此,即使用户折叠扩展器,他也可以看到文档的一部分。没有用于设置内容控件高度的属性,并且下面代码中设置的扩展器高度属性不起作用。 有没有办法实现这个目标?

 private void exPDF_Expanded(object sender, RoutedEventArgs e)
        {
            if (PDFCaption != null)
            {
                PDFCaption.Text = "Click to hide PDF.";
                pdfViewer.Height = this.ActualHeight; 
                exPDF.Height = this.ActualHeight; 
                var rowIndex = Grid.GetRow(sender as Expander);
                var Row = LayoutRoot.RowDefinitions[rowIndex];
                Row.Height = GridLength.Auto;

            }
        }

        private void exPDF_Collapsed(object sender, RoutedEventArgs e)
        {         
            if (PDFCaption != null)
            {
                PDFCaption.Text = "Click to show PDF.";
                pdfViewer.Height = 250;
                exPDF.Height = 250;
                var rowIndex = Grid.GetRow(sender as Expander);
                var Row = LayoutRoot.RowDefinitions[rowIndex];
                Row.Height = GridLength.Auto;

            }

        }

0 个答案:

没有答案