wpfdatagrid

WPF Datagrid Grouping - items with binding converter not updating dynamically

随声附和 提交于 2020-01-25 23:58:18
问题 Am new to WPF and using the datagrid control to group items, data is sourced from a java message Q and items are added dynamically as they arrive. Am using GroupStyle to display the Grouping name, Items Count and a custom converter that reads displays the executed quantity. The issue I have is that the item count updates as and when items arrive but the custom converter class is not invoked. <DataGrid.GroupStyle> ... <TextBlock.Text> <MultiBinding StringFormat="{}{0}, Count: {1:#0}, Executed

Binding not working in DataGrid column header when inside non-primary TabItem

只愿长相守 提交于 2020-01-24 19:37:12
问题 I have a DataGrid which has a bound UI control in its header. The binding is to a a field in a view model. The grid is inside a TabControl . When the grid is on the initial tab in the tab control, all works well. However, when the grid isn't on the initial tab, no binding seems to take place. There's no console output, value converters aren't being invoked, trace level logging isn't reporting anything. Here's a trivial, reproducible example: View Model public class ViewModel :

WPF DataGridTemplateColumn Visibility Binding under MVVM

别来无恙 提交于 2020-01-21 09:03:46
问题 I have a DataGrid bound to an ICollectionView in my ViewModel. The DataGrid is inside a UserControl which is used in a few different data scenarios, some of which require certain DataGrid columns while others don't. I just want to bind the DataGridTemplateColumn's Visibility property to the inner label's Content property so if none of the rows contain a value, it will be hidden. I have a String to Visibility converter set, but can't figure out how to find the inner lable's Content property.

WPF DataGridTemplateColumn Visibility Binding under MVVM

百般思念 提交于 2020-01-21 09:03:25
问题 I have a DataGrid bound to an ICollectionView in my ViewModel. The DataGrid is inside a UserControl which is used in a few different data scenarios, some of which require certain DataGrid columns while others don't. I just want to bind the DataGridTemplateColumn's Visibility property to the inner label's Content property so if none of the rows contain a value, it will be hidden. I have a String to Visibility converter set, but can't figure out how to find the inner lable's Content property.

Programatically bringing a Datagrid column into view (horizontal scroll)

生来就可爱ヽ(ⅴ<●) 提交于 2020-01-21 07:36:14
问题 I would like to bring a column into view programatically. I have a lot of columns and when they are off screen i would like to select a cell and bring that cell into view, i can select a cell that is off screen and when i horizontal scroll to bring the cell visible the cell is selected. i know you can do this with the rows, i.e ScrollIntoView but how about columns? anyone had any luck doing this? and if so how :) (of course) 回答1: Answer : use the datagrid method. public void ScrollIntoView

How to speed up rendering of vertical scrollbar markers

十年热恋 提交于 2020-01-20 07:26:40
问题 I have a customized vertical scrollbar which displays markers for selected items in a DataGrid. The problem I'm facing is, when there are a great number of items (e.g. could be 5000 to 50000) there is a lag while it is rendering the markers. With the following code it basically renders as per the selected items index, number of items and height of the track. Obviously this is inefficient and am looking for other solutions. This is my customized vertical scrollbar <helpers

Silverlight Datagrid Block Selection

社会主义新天地 提交于 2020-01-17 04:17:07
问题 We're trying to add "block select" to the Silverlight DataGrid control: The user should be able to select, for example, a rectangle of cells from ( col 4, row 5 ) to ( col 6, row 8 ). What we're doing is saving the two corners of the selection, and indicating it visually by setting the background color of the cells. We've run into trouble with scrolling, because the cell objects are recycled, along with their formatting. So you scroll up, and as the selected cells vanish off the bottom, bars

WPF Datagrid DataGridTextColumn does not allow decimal

孤者浪人 提交于 2020-01-16 15:21:24
问题 I am not able to enter decimal values in DataGridTextColumn. Below link suggest that we cannot enter decimal values if UpdateSourceTrigger = PropertyChanged. WPF DataGridTextColumn binding doesn't accept decimals But my requirement is that I have to keep UpdateSourceTrigger = PropertyChanged. Please suggest. Below is the code snippet for my Datagrid: <DataGrid x:Name="MyDataGrid" HorizontalAlignment="Left" CanUserResizeColumns="True" VerticalAlignment="Stretch" ItemsSource="{Binding

Enable DataGrid Copy with Custom Columns

柔情痞子 提交于 2020-01-15 07:26:08
问题 I have a DataGrid where I have Custom Columns with Column Templates to insert special Tooltips. When doing that, how do I enable copying this data to clipboard? XAML-Code of my DataGrid: <DataGrid x:Name="CapabilityGrid" IsReadOnly="True" AutoGenerateColumns="False"> <DataGrid.Columns> <DataGridTemplateColumn Header="Variable"> <DataGridTemplateColumn.CellTemplate> <DataTemplate> <TextBlock Text="{Binding Name}" ToolTip="{Binding Name, Converter={StaticResource tooltipConverter}}" /> <

Datagrid : Is there no Sorted event?

妖精的绣舞 提交于 2020-01-13 09:04:25
问题 I need to know when a WPF Datagrid has been sorted by the user. Why is there no Sorted event? I can only find a Sorting event. I also investigated the CollectionView and ListCollectionView that is exposing the objects to the View, without any luck. I am quite surprised as this should come out of the box. Any ideas? 回答1: datagrid has "Sorting" event, subscribe to it! XAML: <DataGrid ItemsSource="{Binding YourItems}" AutoGenerateColumns="True" anUserSortColumns="True" Sorting="DataGrid_Sorting"