Beispiel #1
0
		public void ReadOnlyProperties ()
		{
			Thumb t = new Thumb ();
			Assert.Throws<InvalidOperationException> (delegate {
				t.SetValue (Thumb.IsDraggingProperty, true);
			}, "IsDraggingProperty");
			Assert.Throws<InvalidOperationException> (delegate {
				t.SetValue (Thumb.IsFocusedProperty, true);
			}, "IsFocusedProperty");
		}
Beispiel #2
0
 public ModelThumbRect(double posX, double posY, double w, double h)
 {
     myPath = new Thumb
     {
         Cursor = Cursors.SizeNWSE,
         Opacity = 1,
         Height = w,
         Width = w,
         Background = Brushes.Violet,
         BorderBrush = Brushes.Transparent,
         HorizontalAlignment = HorizontalAlignment.Left,
         VerticalAlignment = VerticalAlignment.Top,
         Margin = new Thickness(w + 5, h + 5, w + 5 - w, h + 5 - h),
     };
     myPath.SetValue(Canvas.LeftProperty, posX-w);
     myPath.SetValue(Canvas.TopProperty, posY-h);
 }
Beispiel #3
0
 public static void SetPopupToMove(Thumb thumb, Popup value)
 {
     thumb.SetValue(PopupToMoveProperty, value);
 }
Beispiel #4
0
 /// <summary>
 /// <see cref="DragablzItem" /> templates contain a thumb, which is used to drag the item around.
 /// For most scenarios this is fine, but by setting this flag to <value>true</value> you can define
 /// a custom thumb in your content, without having to override the template.  This can be useful if you
 /// have extra content; such as a custom button that you want the user to be able to interact with (as usually
 /// the default thumb will handle mouse interaction).
 /// </summary>
 public static void SetIsCustomThumb(Thumb element, bool value)
 {
     element.SetValue(IsCustomThumbProperty, value);
 }
Beispiel #5
0
        private void Build_OnClick(object sender, RoutedEventArgs e)
        {
            if (string.IsNullOrEmpty(RowInput.Text) || string.IsNullOrEmpty(ColumnInput.Text))
            {
                MessageBox.Show("输入点儿东西撒");
                return;
            };

            var rows = int.Parse(RowInput.Text);
            var columns = int.Parse(ColumnInput.Text);

            ResetNTable();

            for (int i = 0; i < rows; i++)
            {
                var rowDef = new RowDefinition() { Height = new GridLength(_nTableData.NCellDefaultHeight) };
                NCellContainer.RowDefinitions.Add(rowDef);
            }

            var columnDefaultWidth = _nTableData.NTableDefaultWidth / columns;
            _nTableData.NCellDefaultWidth = columnDefaultWidth;
            for (int i = 0; i < columns; i++)
            {
                var columnDef = new NTabelColumnDefinition(){ Width = new GridLength(columnDefaultWidth) };
                NCellContainer.ColumnDefinitions.Add(columnDef);

               var  thumb = new Thumb();
                var rd = new ResourceDictionary
                {
                    Source = new Uri("pack://application:,,,/NTable.Core;component/Themes/Common.xaml")
                };
                thumb.Style = (Style)rd["DragThumbVerStyle"];
                thumb.SetValue(Grid.ColumnProperty,i);
                thumb.HorizontalAlignment=HorizontalAlignment.Right;
                NCellContainer.Children.Add(thumb);
            }

            for (var i = 0; i < rows; i++)
            {
                var row = new NTableRow();
                for (var j = 0; j < columns; j++)
                {
                    var nCell = new NCell { Content = i + "," + j };
                    nCell.SetValue(Grid.RowProperty, i);
                    nCell.SetValue(Grid.ColumnProperty, j);
                    NCellContainer.Children.Add(nCell);
                    row.Add(nCell);
                }
                _nTableData.Rows.Add(row);
            }

            for (var i = 0; i < columns; i++)
            {
                var nCellCollection = new NTableColumn();
                for (var j = 0; j < rows; j++)
                {
                    nCellCollection.Add((NCell)NCellContainer.Children[j * columns + i]);
                }
                _nTableData.Columns.Add(nCellCollection);
            }
        }
Beispiel #6
0
        // Helper method to instantiate the corner Thumbs, set the Cursor property, 
        // set some appearance properties, and add the elements to the visual tree.
        void BuildAdornerCorner(ref Thumb cornerThumb, Cursor customizedCursor)
        {
            if (cornerThumb != null) return;

            cornerThumb = new Thumb();

            cornerThumb.Style = FindResource("RoundThumb") as Style;
            // Set some arbitrary visual characteristics.
            cornerThumb.Cursor = customizedCursor;
            cornerThumb.Height = cornerThumb.Width = 10;
            cornerThumb.Opacity = 0.00;
            cornerThumb.SetValue(Canvas.ZIndexProperty, 2);
            cornerThumb.MouseLeave += OnMouseLeave;

            visualChildren.Add(cornerThumb);
        }