コード例 #1
0
        void LoadThongBao()
        {
            SlideNavBarGroup nv2 = new SlideNavBarGroup()
            {
                Header = "Thông báo mới nhất"
            };

            nv2.SetValue(SlideNavBarGroup.RadioButtonStyleProperty, DemoModuleControl.Resources["Group2RadioButtonStyle"]);
            nv2.Background = new SolidColorBrush(Colors.Brown);
            navBar.Groups.Add(nv2);
            for (int i = 0; i < dsthongbao.Count; i++)
            {
                string ten = dsthongbao.ElementAt(i).Title;
                string ma  = dsthongbao.ElementAt(i).ID.ToString();
                if (i % 6 == 0)//Phân trang thông báo bằng cách cứ 6 thông báo thì tạo một TileLayoutControl mới
                {
                    TileLayoutControl temp1 = new TileLayoutControl();
                    temp                      = temp1;
                    temp1.TileClick          += TLYC1_TileClick;
                    temp1.ScrollBars          = ScrollBars.Auto;
                    temp1.Orientation         = Orientation.Horizontal;
                    temp1.HorizontalAlignment = HorizontalAlignment.Center;
                    temp1.VerticalAlignment   = VerticalAlignment.Center;
                    nv2.Items.Add(temp1);
                    CreateTile1(ma, ten);
                }
                else
                {
                    CreateTile1(ma, ten);
                }
            }
        }
コード例 #2
0
        private void tileLayoutControl1_MouseMove(object sender, MouseEventArgs e)
        {
            if (e.LeftButton != MouseButtonState.Pressed)
            {
                return;
            }
            TileLayoutControl tileLayoutControl = sender as TileLayoutControl;
            Point             mousePos          = e.GetPosition(tileLayoutControl1);

            Rect rect = new Rect(
                (point.X - SystemParameters.MinimumHorizontalDragDistance),
                (point.Y - (int)SystemParameters.MinimumVerticalDragDistance),
                SystemParameters.MinimumHorizontalDragDistance * 2,
                SystemParameters.MinimumVerticalDragDistance * 2);

            if (!rect.Contains(mousePos))
            {
                IInputElement hitTest = tileLayoutControl.InputHitTest(mousePos);
                Tile          tile    = LayoutHelper.FindParentObject <Tile>((DependencyObject)hitTest) as Tile;
                if (tile != null)
                {
                    DataObject dragData = new DataObject("LCToGrid", tile.Content);
                    SetToZero();
                    DragDrop.DoDragDrop(tileLayoutControl, dragData, DragDropEffects.Copy);
                }
            }
        }
コード例 #3
0
 public TileSelectionHelper(TileLayoutControl Owner)
 {
     TileLayoutControl                      = Owner;
     SelectedTile                           = -1;
     TileLayoutControl.KeyDown             += new KeyEventHandler(TLC_KeyDown);
     TileLayoutControl.ItemPositionChanged += new DevExpress.Xpf.Core.ValueChangedEventHandler <int>(TLC_ItemPositionChanged);
     TileLayoutControl.PreviewMouseDown    += new MouseButtonEventHandler(TLC_PreviewMouseDown);
     Actions = new MoveActions();
 }
コード例 #4
0
 private void tileLayoutControl1_Drop(object sender, DragEventArgs e)
 {
     if (e.Data.GetDataPresent("GridToLC"))
     {
         ExampleObject     obj        = e.Data.GetData("GridToLC") as ExampleObject;
         TileLayoutControl tileLayout = sender as TileLayoutControl;
         (tileLayout.ItemsSource as ObservableCollection <ExampleObject>).Add(obj);
     }
 }
コード例 #5
0
 public Tile MoveToNextGroup(Point StartPoint, TileLayoutControl TLC)
 {
     for (Double i = StartPoint.Y; i > 0; i -= 10)
     {
         if (TLC.ChildAt(new Point(StartPoint.X, i)) != null)
         {
             return(TLC.ChildAt(new Point(StartPoint.X, i)) as Tile);
         }
     }
     return(null);
 }
コード例 #6
0
        public Tile GetNextTileByDirrection(int SelectedTile, TileLayoutControl TLC, Key key)
        {
            Rect  PrevTileRect = (TLC.Children[SelectedTile] as Tile).Bounds;
            Point P            = GetNextPoinWithOffset(PrevTileRect, TLC.ItemSpace, key);
            Tile  NextTile     = TLC.ChildAt(P) as Tile;

            if (NextTile == null)
            {
                P        = GetNextPoinWithOffset(PrevTileRect, TLC.LayerSpace, key);;
                NextTile = TLC.ChildAt(P) as Tile;
            }
            if (NextTile == null && (key == Key.Right || key == Key.Left))
            {
                NextTile = MoveToNextGroup(P, TLC);
            }
            return(NextTile);
        }