Ejemplo n.º 1
0
        private void UpdateItem(RadHexHubTile item, object context)
        {
            this.owner.UpdateBindings(item);

            if (item.DataContext != context)
            {
                item.DataContext = context;
            }

            var style = this.owner.ItemStyle;

            if (style == null)
            {
                if (this.owner.ItemStyleSelector != null)
                {
                    style = this.owner.ItemStyleSelector.SelectStyle(context, item);
                }
            }

            if (style != null)
            {
                if (item.Style != style)
                {
                    item.Style = style;
                }
            }
            else
            {
                item.ClearValue(RadHexHubTile.StyleProperty);
            }
        }
Ejemplo n.º 2
0
        void IHexViewListener.RaiseItemTap(RadHexHubTile item)
        {
            var handler = this.ItemTap;

            if (handler != null)
            {
                handler(this, new HexViewItemTapEventArgs(item));
            }
        }
Ejemplo n.º 3
0
        private static void UpdateBinding(RadHexHubTile item, DependencyProperty property, string path, IValueConverter converter = null)
        {
            var bindingExpression = item.GetBindingExpression(property);

            if (!string.IsNullOrEmpty(path))
            {
                if (bindingExpression == null || bindingExpression.ParentBinding.Path.Path != path)
                {
                    item.SetBinding(property, new Binding {
                        Path = new PropertyPath(path), Converter = converter
                    });
                }
            }
            else if (bindingExpression != null)
            {
                item.ClearValue(property);
            }
        }
Ejemplo n.º 4
0
        public object GenerateContainerForItem(object item, object containerType)
        {
            UIElement element = null;

            if (containerType != null && containerType.Equals(hexViewItemType))
            {
                var tile = new RadHexHubTile();
                tile.Owner = this.owner;
                element    = tile;
            }
            else
            {
                throw new ArgumentException("Unknown container type.");
            }

            this.owner.ChildrenPanel.Children.Add(element);

            return(element);
        }
Ejemplo n.º 5
0
 internal void UpdateBindings(RadHexHubTile item)
 {
     UpdateBinding(item, RadHexHubTile.ImageSourceProperty, this.ImageSourcePath, this.imageConverter);
     UpdateBinding(item, RadHexHubTile.TitleProperty, this.TitlePath);
     UpdateBinding(item, RadHexHubTile.BackContentProperty, this.BackContentPath);
 }
Ejemplo n.º 6
0
 /// <summary>
 /// Initializes a new instance of the <see cref="HexViewItemTapEventArgs"/> class.
 /// </summary>
 public HexViewItemTapEventArgs(RadHexHubTile item)
 {
     this.Item = item.DataContext;
 }
 public RadHexHubTileAutomationPeer(RadHexHubTile owner)
     : base(owner)
 {
 }