/// <summary> /// 获取 grid 控件的某一行的实际高度 /// </summary> /// <param name="row"></param> /// <returns></returns> private double GetRowDefinitionActualHeight(RowDefinition row) { if (row.Height.IsAbsolute) { return(row.Height.Value); } if (RowDefinitionActualHeightProperty is null) { RowDefinitionActualHeightProperty = row.GetType().GetRuntimeProperties().First((p) => p.Name == "ActualHeight"); } return((double)RowDefinitionActualHeightProperty.GetValue(row)); }
static private double GetRowDefinitionActualHeight(RowDefinition row) { double actualHeight; if (row.Height.IsAbsolute) { actualHeight = row.Height.Value; } else { var property = row.GetType().GetRuntimeProperties().First((p) => p.Name == "ActualHeight"); actualHeight = (double)property.GetValue(row); } return(actualHeight); }