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); } }
void IHexViewListener.RaiseItemTap(RadHexHubTile item) { var handler = this.ItemTap; if (handler != null) { handler(this, new HexViewItemTapEventArgs(item)); } }
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); } }
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); }
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); }
/// <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) { }