public void AddBlock(dax.Document.Block block, IQueryBlock queryBlock, INotificationView notificationView, Action<BindingClickEventArgs> bindingHandler) { var tableItem = new TableControl(block, queryBlock, notificationView); tableItem.OnBindingClick += (s, e) => bindingHandler(e); gridBlocks.Children.Add(tableItem); while (block.Order >= gridBlocks.RowDefinitions.Count) { gridBlocks.RowDefinitions.Add(new RowDefinition()); } Grid.SetRow(tableItem, block.Order); }
public TableControl(dax.Document.Block block, IQueryBlock queryBlock, INotificationView notificationView) { InitializeComponent(); _block = block; _queryBlock = queryBlock; _notificationView = notificationView; if (queryBlock.IsSkipped) { IsSelected = false; } if (queryBlock.IsEmpty) { gridTable.Visibility = Visibility.Collapsed; stackPanelControl.Visibility = Visibility.Collapsed; } RefreshView(); }
private void Hyperlink_Click(dax.Document.Binding binding, RoutedEventArgs e) { if (OnBindingClick != null) { Hyperlink hl = e.OriginalSource as Hyperlink; ContainerVisual container = (ContainerVisual)VisualTreeHelper.GetChild(hl.Parent as TextBlock, 0); String value = (container.Children[0] as TextBlock).Text; OnBindingClick(this, new BindingClickEventArgs(binding, value)); } }