datagrid

Binding datagrid

≡放荡痞女 提交于 2019-12-25 11:59:12
问题 I've been trying to bind DataGridTextColumns column-wise to arrays (int[] I think) and have been unsuccessful. Nothing I've found on msdn, stackoverflow etc has been particularly helpful . <DataGrid AutoGenerateColumns="False" VerticalAlignment="Top" Margin="0,47,0,0" Height="351" Name="dataGrid1" IsReadOnly="True" CanUserAddRows="False" CanUserDeleteRows="False"> <DataGrid.Columns> <DataGridTextColumn Header="Slave Address" Width="100" Binding="{Binding SlaveAddressValues}"/>

RowDetailsTemplate binding

瘦欲@ 提交于 2019-12-25 11:58:45
问题 I have the following xaml <DataGrid AutoGenerateColumns="False" ItemsSource="{Binding Persons, UpdateSourceTrigger=PropertyChanged}" CanUserSortColumns="True" CanUserReorderColumns="False" SelectionMode="Single" SelectionUnit="FullRow" SelectedItem="{Binding Person, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"> <DataGrid.RowDetailsTemplate> <DataTemplate> <TextBlock Text="{Binding EditText, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Height="50"/> </DataTemplate> </DataGrid

RowDetailsTemplate binding

此生再无相见时 提交于 2019-12-25 11:58:02
问题 I have the following xaml <DataGrid AutoGenerateColumns="False" ItemsSource="{Binding Persons, UpdateSourceTrigger=PropertyChanged}" CanUserSortColumns="True" CanUserReorderColumns="False" SelectionMode="Single" SelectionUnit="FullRow" SelectedItem="{Binding Person, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"> <DataGrid.RowDetailsTemplate> <DataTemplate> <TextBlock Text="{Binding EditText, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Height="50"/> </DataTemplate> </DataGrid

Trouble updating my datagrid in WPF

感情迁移 提交于 2019-12-25 11:57:11
问题 As the title indicates, I'm having trouble updating a datagrid in WPF. Basically what I'm trying to accomplish is a datagrid, that is connected to a SQL Server database, that updates automatically once a user enters information into a few textboxes and clicks a submit button. You'll notice that I have a command that joins two tables. The data from the Quote_Data table will be inserted by a different user at a later time. For now my only concern is getting the information from the textboxes

WPF avoid adding a duplicate row

故事扮演 提交于 2019-12-25 11:56:35
问题 I'm using vb.net framework 4.5 and WPF project. I have a button, the function adds a certain product info to a datagrid. In my vb code file I set a product class Public Class MyProduct Public Property ItemNumber As String Public Property ItemDescription As String Public Property ItemUnitPrice As Double Public Property ItemQty As Integer End Class The button touchdown event Private Sub Button_TouchDown(sender As Object, e As TouchEventArgs) Dim dmb As New MyProduct dmb.ItemNumber = "abc001"

how to get the correct index in a datGrid when I use the MVVM pattern and I have a filter in the dataGrid?

泪湿孤枕 提交于 2019-12-25 10:58:07
问题 I have a DataGrid in my view, and I would like to select a row. In my view model I have a property to bind the SelectedIndex of the dataGrid. When I add a new row to the dataGrid, this element is add at the end of the elements, show in the dataGrid I can see it in the last position. However, if i have shorted the elements in the dataGrid because I click in a column name and this filter makes that the new element it will be in the first position of the dataGrid, then I select the incorrect

WPF Datagrid Combobox SelectedItem not Binding to Powershell Object correctly

孤者浪人 提交于 2019-12-25 09:29:46
问题 I am having a bit of trouble correctly binding my Datagrid ComboBox selected item to my PowerShell object. I am using a two way binding for the ComboBox with an 'UpdateSourceTrigger=PropertyChanged' parameter. The source objects correctly get added as items to the ComboBoxes and the source object will update as a selection is changed. However When I save the object or else launch for the first time, the selected items do not get bound. Instead all ComboBoxes are generated as having no

Binding Datasource View to Datagrid in WPF

守給你的承諾、 提交于 2019-12-25 08:49:55
问题 I am trying to get my data to show in a DataGrid. I am using SQL Server 2012 and Visual Studio 2010 and working with a WPF application. I created a new datasource, I chose a "View" that I created in SQL Server. I selected the dropdown on that View in the data pane. I chose the dropdown and clicked on DataGrid. Then I dragged it to a user control. When I run the application, the headers show but the result set does not. When I run the view in SQL server it returns a result set. What am I doing

WPF Datagrid cell value edit - C#

↘锁芯ラ 提交于 2019-12-25 08:28:08
问题 I have a simple datagrid with 2 columns that I populate using an observable collection. The requirement is to enable cell edit for one of the columns and then using a button, save the column data somewhere. This is how I have implemented it so far: View Model: public class PlanningResult : INotifyPropertyChanged { public event PropertyChangedEventHandler PropertyChanged; private void NotifyPropertyChanged([CallerMemberName] String propertyName = "") { if (PropertyChanged != null)

Binding ObservableCollection to DataGrid ComboBox?

爱⌒轻易说出口 提交于 2019-12-25 08:27:33
问题 I am trying to bind the items of the ComboBox with an ObservableCollection, I have been successfully binding them to a StaticResource , The XAML, Nursing_Home_Name is the SQL Server Table and this code works fine for me. <Window.Resources> <local:CollectionsLists x:Key="StaticNursingHomeList" /> </Window.Resources> <DataGridTemplateColumn Width="120" Header="施設名称"> <DataGridTemplateColumn.CellTemplate> <DataTemplate> <TextBlock Text="{Binding UpdateSourceTrigger=PropertyChanged, Path=Nursing