datagrid

Data grid does not show scroll bar and design become obsolete after adding material design in WPF MVVM Application

余生颓废 提交于 2020-08-25 11:39:16
问题 I am using both material design and dragablz:TabablzControl in WPF MVVM application.Material design is used to style button and text box. Grid is located inside tab control.After loading bulk data in to data grid I am facing below design issues. it does not show scroll bar. I have tried with scroll viewer though it didn't work. Actually I can scroll down using arrow key and mouse scroll. But the scroll bar is not visible. When we click on a single row of the data grid that row become

Data grid does not show scroll bar and design become obsolete after adding material design in WPF MVVM Application

主宰稳场 提交于 2020-08-25 11:35:52
问题 I am using both material design and dragablz:TabablzControl in WPF MVVM application.Material design is used to style button and text box. Grid is located inside tab control.After loading bulk data in to data grid I am facing below design issues. it does not show scroll bar. I have tried with scroll viewer though it didn't work. Actually I can scroll down using arrow key and mouse scroll. But the scroll bar is not visible. When we click on a single row of the data grid that row become

Multiple DataGrid columns with the same custom template/style but different binding/context

梦想的初衷 提交于 2020-08-24 03:27:05
问题 I would like to create a custom DataGrid column (or a DataGridCell style), ideally in XAML, and use it multiple times without any code duplication. It should contain multiple different controls, each accessing a different property of the data object. There seem to be two ways of doing this: DataGridTemplateColumn with a custom CellTemplate (see an example here) custom DataGridCell style (something like this or this) Both of these solutions suffer from the same issue. When specifying the

WPF Datagrid Multiple Row Validation

杀马特。学长 韩版系。学妹 提交于 2020-07-22 05:37:48
问题 Apologies if this question has already been asked, but I have not been able to find an answer to my specific problem. I have a WPF datagrid which is bound to a Collection of objects called Waypoint that implements IDataErrorInfo . Each Waypoint object a set of properties that have DataItem which also implements IDataErrorInfo . Each column in the datagrid is bound to the Value property of the DataItem object, and what I want is for the Waypoint object to be bound to the Row Validation

DataGrid.BeginningEdit event not firing when I use TextBox in DataGridTemplateColumn.CellTemplate

余生长醉 提交于 2020-07-09 08:39:02
问题 I want to show data in data grid. And only some of the cells in a column can be edited.So, for this purpose I defined the Column template for one column as shown below: <DataGridTemplateColumn> <DataGridTemplateColumn.CellTemplate> <DataTemplate> <TextBox IsReadOnly="{Binding IsReadOnly}" BorderThickness="0" Text="{Binding Value, UpdateSourceTrigger= LostFocus}"></TextBox> </DataTemplate> </DataGridTemplateColumn.CellTemplate> </DataGridTemplateColumn> So, depending upon the read only

DataGrid.BeginningEdit event not firing when I use TextBox in DataGridTemplateColumn.CellTemplate

可紊 提交于 2020-07-09 08:38:08
问题 I want to show data in data grid. And only some of the cells in a column can be edited.So, for this purpose I defined the Column template for one column as shown below: <DataGridTemplateColumn> <DataGridTemplateColumn.CellTemplate> <DataTemplate> <TextBox IsReadOnly="{Binding IsReadOnly}" BorderThickness="0" Text="{Binding Value, UpdateSourceTrigger= LostFocus}"></TextBox> </DataTemplate> </DataGridTemplateColumn.CellTemplate> </DataGridTemplateColumn> So, depending upon the read only

Multiple selection with checkbox using Datagrid in WPF

拥有回忆 提交于 2020-06-26 04:36:24
问题 I would like to know how to select multiple rows with DataGridCheckBoxColumn . Here I'm able to select only one row, but how to do multiple selection. My XAML is as follows: <UserControl.Resources> <Style x:Key="itemstyle" TargetType="{x:Type DataGridRow}"> <Style.Resources> <SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" Color="LightGoldenrodYellow" /> <SolidColorBrush x:Key="{x:Static SystemColors.ControlBrushKey}" Color="Transparent" /> <SolidColorBrush x:Key="{x:Static

WPF - How to get a cell from a DataGridRow?

荒凉一梦 提交于 2020-06-24 08:42:25
问题 I have a data-bound DataGrid with alternating row background colors. I would like to color a cell differently based on the data it contains. I have tried the solution suggested by this thread http://wpf.codeplex.com/Thread/View.aspx?ThreadId=51143 But, DataGridCellsPresenter presenter = GetVisualChild(row) always returns null. I am using public static T GetVisualChild<T>(Visual parent) where T : Visual { T child = default(T); int numVisuals = VisualTreeHelper.GetChildrenCount(parent); for

ObserveOnDispatcher duplicates records

丶灬走出姿态 提交于 2020-06-17 12:57:18
问题 I'm using WPF with Firebase to work with data. When I use the following code to reveal all data to Datagrid: void ShowProducts() { var products = client .Child("freshfish") .AsObservable<Products>(); ProductsDataGrid.ItemsSource = products .ObserveOnDispatcher() .AsObservableCollection(); } It works well, but after a few minutes it duplicates all the records once again. Here's how it looks: Any ideas? 来源: https://stackoverflow.com/questions/61240052/observeondispatcher-duplicates-records

How to fill DataGrid with DataTable content in UWP c#

半城伤御伤魂 提交于 2020-05-29 11:17:06
问题 I'm creating a UWP app and trying to fill my DataGrid with a DataTable that contains data from my database, but with no success. I have already searched for solutions but just can't get rid of the error. XAML code: <StackPanel> <Button Content="Fill DataGrid" Click="Button_Click"/> <controls:DataGrid x:Name="dataGrid" Margin="30" AutoGenerateColumns="True"> </controls:DataGrid> </StackPanel> C# code: private static DataTable GetDataTable() { DataTable dt = new DataTable(); dt.Columns.Add("ID"