Пример #1
0
                public override bool TryGetMember(GetMemberBinder binder, out object result)
                {
                    string attributeName = binder.Name;

                    if (attributeName == "style")
                    {
                        result = INTERNAL_HtmlDomManager.GetDomElementStyleForModification(_domElementRef);
                    }
                    else
                    {
                        result = INTERNAL_HtmlDomManager.GetDomElementAttribute(_domElementRef, attributeName);
                    }
                    return(true);
                }
Пример #2
0
        private int GetSelectedIndexInNativeHtmlDom()
        {
            if (this._nativeComboBoxDomElement != null)
            {
                int selectedIndexInHtmlDom = Convert.ToInt32(INTERNAL_HtmlDomManager.GetDomElementAttribute(this._nativeComboBoxDomElement, "selectedIndex"));

                // Compensate for the fact that the ComboBox contains an empty
                // element at the beginning (see note in 'AddEmptyOption' method)
                if (selectedIndexInHtmlDom >= 0)
                {
                    selectedIndexInHtmlDom -= 1;
                }

                return(selectedIndexInHtmlDom);
            }

            return(-1);
        }
Пример #3
0
        public int GetSelectedIndexInNativeHtmlDom()
        {
            if (INTERNAL_VisualTreeManager.IsElementInVisualTree(this) && _nativeComboBoxDomElement != null)
            {
                int selectedIndexInHtmlDom = (int)INTERNAL_HtmlDomManager.GetDomElementAttribute(_nativeComboBoxDomElement, "selectedIndex");

                // Compensate for the fact that the ComboBox contains an empty element at the beginning (see note in the CreateDomElement method):
                if (selectedIndexInHtmlDom >= 0)
                {
                    selectedIndexInHtmlDom -= 1;
                }

                return(selectedIndexInHtmlDom);
            }
            else
            {
                return(-1);
            }
        }
Пример #4
0
        //private double GetColumnActualHeight_CSSVersion(ColumnDefinition columnDefinition)
        //{
        //    //the column's height is basically the height of the whole grid, right?
        //    if (CSharpXamlForHtml5.Environment.IsRunningInJavaScript)
        //    {
        //        return _innerDiv.offsetHeight;
        //    }
        //    else
        //    {
        //        INTERNAL_SimulatorExecuteJavaScript.ForceExecutionOfAllPendingCode(); // Explanation: we usually optimize performance in the Simulator by postponing the JS code that sets the CSS properties. This reduces the number of interop calls between C# and the browser. However, in the current case here we need to have all the properties already applied in order to be able to calculate the size of the DOM element. Therefore we need to call the "ForceExecution" method.
        //        return (double)INTERNAL_HtmlDomManager.CastToJsValue_SimulatorOnly(INTERNAL_HtmlDomManager.GetDomElementAttribute(_innerDiv, "offsetHeight"));
        //    }
        //}

        private double GetRowActualHeight_CSSVersion(RowDefinition rowDefinition)
        {
            double returnValue = double.NaN;

            //make a new div that we add to the grid in the correct column, with width and height at 100%, (opacity at 0 ?), position: absolute
            int rowIndex = _rowDefinitionsOrNull.IndexOf(rowDefinition);

            dynamic div1 = AddTemporaryDivForRowOrColumnDimensions(0, rowIndex);

            if (CSharpXamlForHtml5.Environment.IsRunningInJavaScript)
            {
                returnValue = div1.offsetHeight;
            }
            else
            {
                returnValue = Convert.ToDouble(INTERNAL_HtmlDomManager.GetDomElementAttribute(div1, "offsetHeight"));
            }

            INTERNAL_HtmlDomManager.RemoveFromDom(div1);

            return(returnValue);
        }
Пример #5
0
        private double GetColumnActualWidth_CSSVersion(ColumnDefinition columnDefinition)
        {
            double returnValue = 0;

            //make a new div that we add to the grid in the correct column, with width and height at 100%, (opacity at 0 ?), position: absolute
            int columnIndex = _columnDefinitionsOrNull.IndexOf(columnDefinition);

            var div1 = AddTemporaryDivForRowOrColumnDimensions(columnIndex, 0);

            if (CSharpXamlForHtml5.Environment.IsRunningInJavaScript)
            {
                returnValue = ((dynamic)div1).offsetWidth;
            }
            else
            {
                returnValue = Convert.ToDouble(INTERNAL_HtmlDomManager.GetDomElementAttribute(div1, "offsetWidth"));
            }

            INTERNAL_HtmlDomManager.RemoveFromDom(div1);

            return(returnValue);
        }