예제 #1
0
        public void CtorDefault()
        {
            GridLength gl = new GridLength();

            CheckAuto(gl);
            Assert.IsTrue(gl.Equals(GridLength.Auto), "Equals(Auto)");
            Assert.IsTrue(gl.Equals(GridLength.Auto), "Auto.Equals");
            Assert.IsTrue(gl == GridLength.Auto, "==");
            Assert.IsFalse(gl != GridLength.Auto, "!=");
        }
예제 #2
0
 public void Equals_Object_ReturnsExpected(GridLength gridLength, object other, bool expected)
 {
     Assert.Equal(expected, gridLength.Equals(other));
     if (other is GridLength otherGridLength)
     {
         Assert.Equal(expected, gridLength.Equals(otherGridLength));
         Assert.Equal(expected, gridLength == otherGridLength);
         Assert.Equal(!expected, gridLength != otherGridLength);
         Assert.Equal(expected, gridLength.GetHashCode().Equals(otherGridLength.GetHashCode()));
     }
 }
예제 #3
0
        static void CheckAuto(GridLength gl)
        {
            Assert.AreEqual(1.0d, gl.Value, "Value");
            Assert.AreEqual(GridUnitType.Auto, gl.GridUnitType, "GridUnitType");
            Assert.IsFalse(gl.IsAbsolute, "IsAbsolute");
            Assert.IsTrue(gl.IsAuto, "IsAuto");
            Assert.IsFalse(gl.IsStar, "IsStar");
            Assert.AreEqual("Auto", gl.ToString(), "ToString");

            Assert.IsFalse(gl.Equals(null), "Equals(null)");
            Assert.IsTrue(gl.Equals(gl), "Equals(self)");
        }
예제 #4
0
        void btnGrdSplitter_Click(object sender, RoutedEventArgs e)
        {
            GridLength temp = grdWorkbench.ColumnDefinitions[0].Width;
            GridLength zero = new GridLength(0);

            if (!temp.Equals(zero))
            {
                //折叠
                m_WidthCache = grdWorkbench.ColumnDefinitions[0].Width;
                grdWorkbench.ColumnDefinitions[0].Width = new GridLength(0);
            }
            else
            {
                //恢复
                grdWorkbench.ColumnDefinitions[0].Width = m_WidthCache;
            }
        }
예제 #5
0
        private void BtnGrdSplitter_Click(object sender, RoutedEventArgs e)
        {
            GridLength temp = grdWorkbench.ColumnDefinitions[2].Width;
            GridLength def  = new GridLength(0);

            if (temp.Equals(def))
            {
                grdWorkbench.ColumnDefinitions[2].Width = _widthCache;
                _btnGrdSplitter.Content = ">";
            }
            else
            {
                _btnGrdSplitter.Content = "<";
                _widthCache             = grdWorkbench.ColumnDefinitions[2].Width;
                grdWorkbench.ColumnDefinitions[2].Width = def;
            }
        }
 /// <summary>
 /// Writes the attribute.
 /// </summary>
 /// <param name="name">The name.</param>
 /// <param name="value">The value.</param>
 /// <param name="defaultValue">The default value.</param>
 protected void WriteAttribute(string name, GridLength value, GridLength defaultValue)
 {
     if (this.settings.WriteDefaultValues || !value.Equals(defaultValue)) {
         this.writer.WriteAttributeString(name, value.Format());
     }
 }