Search Results

Search found 91 results on 4 pages for 'datagridtextcolumn'.

Page 2/4 | < Previous Page | 1 2 3 4  | Next Page >

  • DataGrid : Binding with two different classes with lists ? WPF C#

    - by MyRestlessDream
    It is my first question on StackOverflow so I hope I am doing nothing wrong ! Sorry if it is the case ! I need some help because I can not find the solution of my problem. Of course I have searched everywhere on the web but I can not find it (can not post the links that I am using because of my low reputation :( ). Moreover, I am new in C# and WPF (and self-learning). I used to work in C++/Qt so I do not know how everything works in WPF. And sorry for my English, I am French. My problem My basic classes are that an Employee can use a computer. The id of the computer and the date of use are stored into the class Connection. I would like to display the list information in a DataGrid and in RowDetailsTemplate like here : http://i.stack.imgur.com/Bvn1z.png So it will do a binding to the Employee class but also to the Connection class with only the last value of the property (here the last value of the list "Computer ID" and the last value of the list "Connection Date" on this last computer). So it is a loop in the different lists. How can I do it ? Is it too much to do ? :( I succeed to get the Employee informations but I do not know how to bind the list of computer. When I am trying, it shows me "(Collection)" so it does not go inside the list :( Summary of Questions How to display/bind a value from a list AND from a different class in a DataGrid ? How to display all the values of a list into the RowDetailsTemplate ? Under Windows 7 and Visual Studio 2010 Pro version. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ EDIT ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Solution I have used the solution of Stefan Denchev. Here the modification of my class : http://i.stack.imgur.com/Ijx5i.png And the code used: <DataGrid ItemsSource="{Binding}" Name="table"> <DataGrid.Columns> <DataGridTextColumn Header="First Name" Binding="{Binding FirstName}"/> <DataGridTextColumn Header="Last Name" Binding="{Binding LastName}"/> <DataGridTextColumn Header="Gender" Binding="{Binding Gender}"/> <DataGridTextColumn Header="Last computer used" Binding="{Binding LastComputerID}"/> <DataGridTextColumn Header="Last connection date" Binding="{Binding LastDate}"/> </DataGrid.Columns> <DataGrid.RowDetailsTemplate> <DataTemplate> <DataGrid ItemsSource="{Binding ListOfConnection}"> <DataGrid.Columns> <DataGridTextColumn Header="Computer ID" Binding="{Binding ComputerID}"/> <DataGridTemplateColumn> <DataGridTemplateColumn.CellTemplate> <DataTemplate> <ListView ItemsSource="{Binding ListOfDate}"/> </DataTemplate> </DataGridTemplateColumn.CellTemplate> </DataGridTemplateColumn> </DataGrid.Columns> </DataGrid> </DataTemplate> </DataGrid.RowDetailsTemplate> </DataGrid> With in code behind : List<Employee> allEmployees = WorkflowMgr.Instance.AllEmployees; table.DataContext = allEmployees; And it works ! I have tryed to improve my fake example :) Hope it will help to another developer !

    Read the article

  • Pass data to Child Window in Silverlight 4 using MVVM

    - by Archie
    Hello, I have a datagrid with master detail implementation as follows: <data:DataGrid x:Name="dgData" Width="600" ItemsSource="{Binding Path=ItemCollection}" HorizontalScrollBarVisibility="Hidden" CanUserSortColumns="False" RowDetailsVisibilityChanged="dgData_RowDetailsVisibilityChanged"> <data:DataGrid.Columns> <data:DataGridTextColumn Header="Item" Width="*" Binding="{Binding Item,Mode=TwoWay}"/> <data:DataGridTextColumn Header="Company" Width="*" Binding="{Binding Company,Mode=TwoWay}"/> </data:DataGrid.Columns> <data:DataGrid.RowDetailsTemplate> <DataTemplate> <data:DataGrid x:Name="dgrdRowDetail" Width="400" AutoGenerateColumns="False" HorizontalAlignment="Center" HorizontalScrollBarVisibility="Hidden" Grid.Row="1"> <data:DataGrid.Columns> <data:DataGridTextColumn Header="Date" Width="*" Binding="{Binding Date,Mode=TwoWay}"/> <data:DataGridTextColumn Header="Price" Width="*" Binding="{Binding Price, Mode=TwoWay}"/> <data:DataGridTemplateColumn> <data:DataGridTemplateColumn.CellTemplate> <DataTemplate> <Button Content="Show More Details" Click="buttonShowDetail_Click"></Button> </DataTemplate> </data:DataGridTemplateColumn.CellTemplate> </data:DataGridTemplateColumn> </data:DataGrid.Columns> </data:DataGrid> </DataTemplate> </data:DataGrid.RowDetailsTemplate> </data:DataGrid> I want to open a Child window in clicking the button which shows more details about the product. I'm using MVVM pattern. My Model contains a method which takes the Item name as input and retursn the Details data. My problem is how should I pass the Item to ViewModel which will get the Details data from Model? and where shoukd I open the new Child Window? In View or ViewModel? Please help.Thanks.

    Read the article

  • Datapager in silverlight 4 -Nested datagrid visibility issue

    - by Archie
    I have a datagrid in silverlight with child datagrid nested in it. Also I have a DataPager on the outer datagrid. The code looks like this: <data:DataGrid x:Name="dgData" Width="600" ItemsSource="{Binding}" AutoGenerateColumns="False" IsReadOnly="True" HorizontalScrollBarVisibility="Hidden" CanUserSortColumns="False" RowDetailsVisibilityChanged="dgData_RowDetailsVisibilityChanged" Margin="20,0" Grid.RowSpan="2"> <data:DataGrid.Columns> <data:DataGridTextColumn Header="Item" Width="*" Binding="{Binding ItemName,Mode=TwoWay}"/> <data:DataGridTextColumn Header="Company" Width="*" Binding="{Binding Company,Mode=TwoWay}"/> </data:DataGrid.Columns> <data:DataGrid.RowDetailsTemplate> <DataTemplate> <data:DataGrid x:Name="dgRowDetail" Width="400" HorizontalScrollBarVisibility="Hidden" AutoGenerateColumns="False" Visibility="Collapsed"> <data:DataGrid.Columns> <data:DataGridTextColumn Header="Date" Width="*" Binding="{Binding Date,Mode=TwoWay}"/> <data:DataGridTextColumn Header="Price" Width="*" Binding="{Binding Price,Mode=TwoWay}"/> </data:DataGrid.Columns> </data:DataGrid> </DataTemplate> </data:DataGrid.RowDetailsTemplate> </data:DataGrid> <data:DataPager x:Name="dpData" HorizontalAlignment="Center" DisplayMode="FirstLastPreviousNextNumeric" Source="{Binding}"/> I have one PagedCollectionView pgv which is bound to outer datagrid as: DataContext = pgv; When the row is clicked I set the child datagrid's ItemsSource property to another PagedCollectionView. My problem is it works fine except for the first row for the first time. When I click on it, it doesn't fire the dgData_RowDetailsVisibilityChanged event. Also, when I click on second row, firstly first row fires the event and then the second row fires it and shows the nested grid. Please help.

    Read the article

  • Silverlight: Problem using CellEditingTemplate

    - by Charles
    Hello Silverlight gurus, I am experiencing a problem with the DataGrid where my data-bound object's properties are not being updated when using the CellTemplate/CellEditingTemplate: <data:DataGridTemplateColumn Header="Text"> <data:DataGridTemplateColumn.CellTemplate> <DataTemplate> <TextBlock Text="{Binding Text}" ></TextBlock> </DataTemplate> </data:DataGridTemplateColumn.CellTemplate> <data:DataGridTemplateColumn.CellEditingTemplate> <DataTemplate> <TextBox Text="{Binding Text, Mode=TwoWay}" /> </DataTemplate> </data:DataGridTemplateColumn.CellEditingTemplate> </data:DataGridTemplateColumn> I am binding to a code-gen'd entity via the RIA Services. I've added an event handler to the PropertyChanged event, and it is never fired. However, if I do not use a template and instead use a DataGridTextColumn, everything works fine. I'm sure this sounds like an easy fix - I'm only using a TextBox in my editing template, so why not us a DataGridTextColumn? The problem is that I want to have a multi-line textbox, so using the DataGridTextColumn is not an option. Any suggestions? Do you know of any differences between using a CellEditingTemplate containing a single TextBox and using a DataGridTextColumn? Thanks, -Charles [UPDATE] I posted a bug report here: http://silverlight.net/forums/p/118729/267521.aspx I can't imagine that this is "as-designed"... If someone else has known about this and I'm just being dumb, I'd appreciate an explanation - I'd prefer embarrassment over ignorance :).

    Read the article

  • expand an collapse button in datagrid

    - by prince23
    hi, <sdk:DataGrid MinHeight="100" x:Name="dgCounty" AutoGenerateColumns="False" VerticalAlignment="Top" IsReadOnly="True" Margin="5,5,5,0" RowDetailsVisibilityChanged="dgCounty_RowDetailsVisibilityChanged" RowDetailsVisibilityMode="VisibleWhenSelected"> <sdk:DataGrid.Columns> <sdk:DataGridTemplateColumn CanUserReorder="False"> <sdk:DataGridTemplateColumn.CellTemplate> <DataTemplate> <Button x:Name="ViewButton" Click="ToggleRowDetailsVisibility" Cursor="Hand" Content="View Details" /> </DataTemplate> </sdk:DataGridTemplateColumn.CellTemplate> </sdk:DataGridTemplateColumn> <sdk:DataGridTextColumn Header="Countryname" Width="100" Binding="{Binding Region Name}" CanUserReorder="False"/> <sdk:DataGridTextColumn Header="Populution" Width="80" Binding="{Binding Number Of People}" CanUserReorder="False"/> </sdk:DataGrid.Columns> <sdk:DataGrid.RowDetailsTemplate> <DataTemplate> <sdk:DataGrid x:Name="dgrdRowDetail" Width="400" AutoGenerateColumns="False" HorizontalAlignment="Center" IsReadOnly="True" Grid.Row="1"> <sdk:DataGrid.Columns> <sdk:DataGridTextColumn Header="county" Binding="{Binding CompanyName}"/> <sdk:DataGridTextColumn Header="Number Of People" Binding="{Binding CompanyID}"/> </sdk:DataGrid.Columns> </sdk:DataGrid> </DataTemplate> </sdk:DataGrid.RowDetailsTemplate> </sdk:DataGrid> how to make an button in datagrid expand an collapse where there will be 2 image buttons once user clicks the button the rows under it will expand where there should be an one image button with (- symbol) again user clicks the same row the rows which were expanded should collapse.(+ image button) here i have done the function for doing the expand and collapse is completed. now only i need add an image which will change once the user clicks the row either ( we can do it by javascript or in code behind ?) how can i change the image button like that can any one tell me how i should i ahead or any code that can help me to solve the issue thanks in adance prince

    Read the article

  • Should i use a trigger or Behaviors for this?

    - by Michael
    I have an abstract object called Applicant and two different types of objects that inherit from Applicant called Business and Individual. So I have three classes that look like this: public abstract class Applicant { ... } public class Individual : Applicant { ... } public class Business : Applicant { ... } Now in the DataGrid I want to show all the details of Applicant object. When you choose a row I want to show details of either the business or individual as a internal grid. Something like this <DataGrid> <DataGrid.Columns> <!--Show different columns --> </DataGrid.Columns> <DataGrid.RowDetailsTemplate> <!--Show if Individual --> <DataGrid> <DataGrid.Columns> <DataGridTextColumn Header="First Name" ... /> <DataGridTextColumn Header="Last Name" ... /> </DataGrid.Columns> </DataGrid> <!--Show if business --> <DataGrid> <DataGrid.Columns> <DataGridTextColumn Header="Business Name" ... /> <DataGridTextColumn Header="Tax id" ... /> </DataGrid.Columns> </DataGrid> </DataGrid.RowDetailsTemplate> </DataGrid> Now I'm not sure if I need to use a Triggers or Behaviors to accomplish this? Thanks for everyones help! FYI I'm using Silverlight 4.0 with Prism.

    Read the article

  • how to text-align columns in DataGrid? (style DataGridCell)

    - by Olga
    I use WPF (C #). I use DataGrid. I want the first column is aligned with the center, the other columns are right-aligned. I have style: <Style x:Key="TextInCellCenter" TargetType="{x:Type TextBlock}" > <Setter Property="HorizontalAlignment" Value="Center"/> </Style> <Style TargetType="{x:Type DataGridCell}"> <Setter Property="HorizontalAlignment" Value="Right"/> </Style> DataGrid: <DataGrid> <DataGrid.Columns> <DataGridTextColumn ElementStyle="{StaticResource TextInCellCenter}" Binding="{Binding Path=Name}" /> <DataGridTextColumn Binding="{Binding Path=Number}" /> <DataGridTextColumn Binding="{Binding Path=Number}" /> <DataGridTextColumn Binding="{Binding Path=Number}" /> I have all the columns are right-aligned. Please tell me, how do I change the first column had a center text-alignment?

    Read the article

  • WPF DataGrid populating blank rows on TreeView's SelectedItemChanged

    - by jes9582
    When my DataGrid populates on the TreeView's SelectedItemChanged event it finds the objects and creates the rows accordingly but the rows populate with no text or are just blank. So I know it is finding my objects but it is not displaying them properly. Does anyone see where I made an error or suggest any changes or fixes? Thank you in advance! Here is the CSharp code that is setting the DataGrid's ItemsSource (I am using .dbml and LINQ with Lambda expressions): dgSystemSettings.ItemsSource = (tvSystemConfiguration.SelectedItem as SYSTEM_SETTINGS_GROUP).SYSTEM_SETTINGS_NAMEs.Join(ssdc.SYSTEM_SETTINGS_VALUEs, x => x.SSN_ID, y => y.SSV_SSN_ID, (x, y) => new { SYSTEM_SETTINGS_NAME = x, SYSTEM_SETTINGS_VALUE = y }); And here is the .xaml: <DataGrid Name="dgSystemSettings" AutoGenerateColumns="False" Height="447" Width="513" DockPanel.Dock="Right" ItemsSource="{Binding}" VerticalAlignment="Top" Margin="10,10,0,0"> <DataGrid.Columns> <DataGridTextColumn x:Name="colDisplayName" Header="Name" Binding="{Binding SSN_DISPLAY_NAME}"></DataGridTextColumn> <DataGridTextColumn x:Name="colValue" Header="Value" Binding="{Binding SSV_VALUE}"></DataGridTextColumn> </DataGrid.Columns> </DataGrid>

    Read the article

  • Increase columns width in Silverlight DataGrid to fill whole DG width

    - by Henrik P. Hessel
    Hello, I have a DataGrid Control which is bound to a SQL Table. The XAML Code is: <data:DataGrid x:Name="dg_sql_data" Grid.Row="1" Visibility="Collapsed" Height="auto" Margin="0,5,5,5" AutoGenerateColumns="false" AlternatingRowBackground="Aqua" Opacity="80" > <data:DataGrid.Columns> <data:DataGridTextColumn Header="Latitude" Binding="{Binding lat}" /> <data:DataGridTextColumn Header="Longitude" Binding="{Binding long}" /> <data:DataGridTextColumn Header="Time" Binding="{Binding time}" /> </data:DataGrid.Columns> </data:DataGrid> Is it possible increase the single columns sizes to fill out the complete width of the datagrid? thx!, rAyt Edit: Columns with "*" as width are coming with the Silverlight SDK 4.

    Read the article

  • How can I bind dynamic data to DataGridTemplateColumn in code?

    - by TuomoT
    I'm using DataGrid from CodePlex. I have objects (ICustomTypeDescriptor) that have properties 'name' 'description' 'c' 'd' and so on (the names are dynamic, and so is the value) and they have information behind them. I have templates for different types. And if I have to list the properties of a single element I can just bind to the values in xaml and use datatemplateselector (in datagridtemplatecolumn) which will pick the correct template. However, when I'm listing several of the elements, how can I use the selectors and the templates? How do I get the correct property bound to the template (two-way)? When ignoring the need for different templates, using DataGridTextColumn with bindings is very simple (and works, see example below), is there any way to use similar approach with the DataGridTemplateColumn? foreach (String propertyName in listOfPropertyNames) { DataGridTextColumn textColumn = new DataGridTextColumn() { Header = propertyName, Binding = new Binding() { Path = new PropertyPath(propertyName) } }; DataGrid.Columns.Add(textColumn); }

    Read the article

  • How can I bind dynamic data to DataGridTemplateColun in code?

    - by TuomoT
    I'm using DataGrid from CodePlex. I have objects (ICustomTypeDescriptor) that have properties 'name' 'description' 'c' 'd' and so on (the names are dynamic, and so is the value) and they have information behind them. I have templates for different types. And if I have to list the properties of a single element I can just bind to the values in xaml and use datatemplateselector (in datagridtemplatecolumn) which will pick the correct template. However, when I'm listing several of the elements, how can I use the selectors and the templates? How do I get the correct property bound to the template (two-way)? When ignoring the need for different templates, using DataGridTextColumn with bindings is very simple (and works, see example below), is there any way to use similar approach with the DataGridTemplateColumn? foreach (String propertyName in listOfPropertyNames) { DataGridTextColumn textColumn = new DataGridTextColumn() { Header = propertyName, Binding = new Binding() { Path = new PropertyPath(propertyName) } }; DataGrid.Columns.Add(textColumn); }

    Read the article

  • WPF: Bind DataGrid to List<String>

    - by Sam
    Funny, how sometimes the simple things bite me in the behind. I can bind a DataGrid nicely to a Collection of some arbitrary class, using a DataGridTextColumn like this: <DataGridTextColumn Header="Name" Binding="{Binding Name}"/> Now I want to bind a DataGrid to a simple Collection. So since there is no property "Name" or something like that to bind to, how do I write the binding: <DataGridTextColumn Header="Name" Binding="{Binding ???}"/> String has no Property "Value" or something like that. And if I just write {Binding } I'll end up with a one-way-binding, unable to write changes back to the Collection. Thinking about it, I think it is not possible to bind to a collection, so I do need to wrap my string into a class? Or is there a way?

    Read the article

  • Why is my WCF RIA Services custom object deserializing with an extra list member?

    - by oasasaurus
    I have been developing a Silverlight WCF RIA Services application dealing with mock financial transactions. To more efficiently send summary data to the client without going overboard with serialized entities I have created a summary class that isn’t in my EDM, and figured out how to serialize and send it over the wire to the SL client using DataContract() and DataMember(). Everything seemed to be working out great, until I tried to bind controls to a list inside my custom object. The list seems to always get deserialized with an extra, almost empty entity in it that I don’t know how to get rid of. So, here are some of the pieces. First the relevant bits from the custom object class: <DataContract()> _ Public Class EconomicsSummary Public Sub New() RecentTransactions = New List(Of Transaction) TotalAccountHistory = New List(Of Transaction) End Sub Public Sub New(ByVal enUser As EntityUser) Me.UserId = enUser.UserId Me.UserName = enUser.UserName Me.Accounts = enUser.Accounts Me.Jobs = enUser.Jobs RecentTransactions = New List(Of Transaction) TotalAccountHistory = New List(Of Transaction) End Sub <DataMember()> _ <Key()> _ Public Property UserId As System.Guid <DataMember()> _ Public Property NumTransactions As Integer <DataMember()> _ <Include()> _ <Association("Summary_RecentTransactions", "UserId", "User_UserId")> _ Public Property RecentTransactions As List(Of Transaction) <DataMember()> _ <Include()> _ <Association("Summary_TotalAccountHistory", "UserId", "User_UserId")> _ Public Property TotalAccountHistory As List(Of Transaction) End Class Next, the relevant parts of the function called to return the object: Public Function GetEconomicsSummary(ByVal guidUserId As System.Guid) As EconomicsSummary Dim objOutput As New EconomicsSummary(enUser) For Each objTransaction As Transaction In (From t As Transaction In Me.ObjectContext.Transactions.Include("Account") Where t.Account.aspnet_User_UserId = guidUserId Select t Order By t.TransactionDate Descending Take 10) objTransaction.User_UserId = objOutput.UserId objOutput.RecentTransactions.Add(objTransaction) Next objOutput.NumTransactions = objOutput.RecentTransactions.Count … Return objOutput End Function Notice that I’m collecting the NumTransactions count before serialization. Should be 10 right? It is – BEFORE serialization. The DataGrid is bound to the data source as follows: <sdk:DataGrid AutoGenerateColumns="False" Height="100" MaxWidth="{Binding ElementName=aciSummary, Path=ActualWidth}" ItemsSource="{Binding Source={StaticResource EconomicsSummaryRecentTransactionsViewSource}, Mode=OneWay}" Name="gridRecentTransactions" RowDetailsVisibilityMode="VisibleWhenSelected" IsReadOnly="True"> <sdk:DataGrid.Columns> <sdk:DataGridTextColumn x:Name="TransactionDateColumn" Binding="{Binding Path=TransactionDate, StringFormat=\{0:d\}}" Header="Date" Width="SizeToHeader" /> <sdk:DataGridTextColumn x:Name="AccountNameColumn" Binding="{Binding Path=Account.Title}" Header="Account" Width="SizeToCells" /> <sdk:DataGridTextColumn x:Name="CurrencyAmountColumn" Binding="{Binding Path=CurrencyAmount, StringFormat=\{0:c\}}" Header="Amount" Width="SizeToHeader" /> <sdk:DataGridTextColumn x:Name="TitleColumn" Binding="{Binding Path=Title}" Header="Description" Width="SizeToCells" /> <sdk:DataGridTextColumn x:Name="ItemQuantityColumn" Binding="{Binding Path=ItemQuantity}" Header="Qty" Width="SizeToHeader" /> </sdk:DataGrid.Columns> </sdk:DataGrid> You might be wondering where the ItemsSource is coming from, that looks like this: <CollectionViewSource x:Key="EconomicsSummaryRecentTransactionsViewSource" Source="{Binding Path=DataView.RecentTransactions, ElementName=EconomicsSummaryDomainDataSource}" /> When I noticed that the DataGrid had the extra row I tried outputting some data after the data source finishes loading, as follows: Private Sub EconomicsSummaryDomainDataSource_LoadedData(ByVal sender As System.Object, ByVal e As System.Windows.Controls.LoadedDataEventArgs) Handles EconomicsSummaryDomainDataSource.LoadedData If e.HasError Then System.Windows.MessageBox.Show(e.Error.ToString, "Load Error", System.Windows.MessageBoxButton.OK) e.MarkErrorAsHandled() End If Dim objSummary As EconomicsSummary = CType(EconomicsSummaryDomainDataSource.Data(0), EconomicsSummary) Dim sb As New StringBuilder("") sb.AppendLine(String.Format("Num Transactions: {0} ({1})", objSummary.RecentTransactions.Count.ToString(), objSummary.NumTransactions.ToString())) For Each objTransaction As Transaction In objSummary.RecentTransactions sb.AppendLine(String.Format("Recent TransactionId {0} dated {1} CurrencyAmount {2} NewBalance {3}", objTransaction.TransactionId.ToString, objTransaction.TransactionDate.ToString("d"), objTransaction.CurrencyAmount.ToString("c"), objTransaction.NewBalance.ToString("c"))) Next txtDebug.Text = sb.ToString() End Sub Output from that looks like this: Num Transactions: 11 (10) Recent TransactionId 2283 dated 6/1/2010 CurrencyAmount $31.00 NewBalance $392.00 Recent TransactionId 2281 dated 5/31/2010 CurrencyAmount $33.00 NewBalance $361.00 Recent TransactionId 2279 dated 5/28/2010 CurrencyAmount $8.00 NewBalance $328.00 Recent TransactionId 2277 dated 5/26/2010 CurrencyAmount $22.00 NewBalance $320.00 Recent TransactionId 2275 dated 5/24/2010 CurrencyAmount $5.00 NewBalance $298.00 Recent TransactionId 2273 dated 5/21/2010 CurrencyAmount $19.00 NewBalance $293.00 Recent TransactionId 2271 dated 5/20/2010 CurrencyAmount $20.00 NewBalance $274.00 Recent TransactionId 2269 dated 5/19/2010 CurrencyAmount $48.00 NewBalance $254.00 Recent TransactionId 2267 dated 5/18/2010 CurrencyAmount $42.00 NewBalance $206.00 Recent TransactionId 2265 dated 5/14/2010 CurrencyAmount $5.00 NewBalance $164.00 Recent TransactionId 0 dated 6/1/2010 CurrencyAmount $0.00 NewBalance $361.00 So I have a few different questions: -First and foremost, where the devil is that extra Transaction entity coming from and how do I get rid of it? Does it have anything to do with the other list of Transaction entities being serialized as part of the EconomicsSummary class (TotalAccountHistory)? Do I need to decorate the EconomicsSummary class members a little more/differently? -Second, where are the peculiar values coming from on that extra entity? PRE-POSTING UPDATE 1: I did a little checking, it looks like that last entry is the first one in the TotalAccountHistory list. Do I need to do something with CollectionDataContract()? PRE-POSTING UPDATE 2: I fixed one bug in TotalAccountHistory, since the objects weren’t coming from the database their keys weren’t unique. So I set the keys on the Transaction entities inside TotalAccountHistory to be unique and guess what? Now, after deserialization RecentTransactions contains all its original items, plus every item in TotalAccountHistory. I’m pretty sure this has to do with the deserializer getting confused by two collections of the same type. But I don’t yet know how to resolve it…

    Read the article

  • Implementing the double-click event on Silverlight 4 Datagrid

    - by Mohammed Mudassir Azeemi
    Any good soul have an example of implementing the "Command Pattern" introduced by Prism on "Double-click event" of Silverlight 4.0 DataGrid. I did try the following: <data:DataGrid x:Name="dgUserRoles" AutoGenerateColumns="False" Margin="0" Grid.Row="0" ItemsSource="{Binding Path=SelectedUser.UserRoles}" IsReadOnly="False" > <data:DataGrid.Columns> <data:DataGridTemplateColumn Header=" "> <data:DataGridTemplateColumn.CellTemplate> <DataTemplate> <Button Width="20" Height="20" Click="Button_Click" Command="{Binding EditRoleClickedCommand}" CommandParameter="{Binding SelectedRole}" > </Button> </DataTemplate> </data:DataGridTemplateColumn.CellTemplate> </data:DataGridTemplateColumn> <data:DataGridTextColumn Header="Role Name" Binding="{Binding RoleName}" /> <data:DataGridTextColumn Header="Role Code" Binding="{Binding UserroleCode}" IsReadOnly="True"/> <data:DataGridCheckBoxColumn Header="UDFM Managed" Binding="{Binding RoleIsManaged}" IsReadOnly="True" /> <data:DataGridCheckBoxColumn Header="UDFM Role Assigned" Binding="{Binding UserroleIsUdfmRoleAssignment}" IsReadOnly="True" /> <data:DataGridTextColumn Header="Source User" Binding="{Binding SourceUser}" IsReadOnly="True" /> </data:DataGrid.Columns> </data:DataGrid> As you see I did try to hook up the Command there and it is not firing the event in my View Model. Looking for a good alternative.

    Read the article

  • WPF trigger on datagrid to hide/show columns according to bindings

    - by Renan
    I have a data grid like this: <DataGrid AutoGenerateColumns="False" CanUserDeleteRows="True" HorizontalScrollBarVisibility="Hidden" Margin="10,10,10,10" VerticalScrollBarVisibility="Visible" CanUserAddRows="False" ItemsSource="{Binding ListGestores}" ToolTip="Selecione uma linha e pressione DELETE para remover uma unidade."> <DataGrid.Columns> <DataGridTextColumn Binding="{Binding TB_UNIDADE.DS_NOME_UNIDADE}" CanUserResize="False" Header="Setor" IsReadOnly="True" x:Name=""/> <DataGridTextColumn Binding="{Binding TB_UNIDADE.TB_UNIDADE2.DS_NOME_UNIDADE}" CanUserResize="False" Header="Unidade" IsReadOnly="True" x:Name=""/> <DataGridTextColumn Binding="{Binding TB_CONTATOS.DS_NOME}" CanUserResize="False" Header="Gestor" IsReadOnly="True" /> </DataGrid.Columns> </DataGrid> The problem is that i need to verify if the 2 column binding is null, and if it is null, i need to Hide it, and Change the Header of the column 1. I know that i can do that with Triggers, but how exactly??? I started with: <DataGrid.Triggers> <DataTrigger Binding="{Binding TB_UNIDADE.TB_UNIDADE2}" Value="{x:Null}"> <Setter Property="" Value="" /> </DataTrigger> </DataGrid.Triggers> But i don't know what setter or whatever to put ! Help me =]

    Read the article

  • How can I sort a DataGridTemplateColumn on a WPF Toolkit DataGrid?

    - by Kilhoffer
    I have a WPF Toolkit DataGrid with one DataGridTemplateColumn. I've specified in a grid attribute that I wish all columns to be sortable, but the DataGridTemplateColumn won't allow it. All other columns do allow sorting. I've even tried explicitly setting CanUserSort to true for that column, but no luck. Is it even possible to sort a template column? I've provided a custom sorter that works for all columns, but the header won't allow a sort click. <Controls:DataGrid ItemsSource="{Binding Events}" AutoGenerateColumns="False" CanUserSortColumns="True" CanUserReorderColumns="False" Sorting="DataGrid_Sorting" x:Name="EventsGrid"> <Controls:DataGrid.Columns> <Controls:DataGridTemplateColumn Header="Type" Width="42" CanUserResize="False"> <Controls:DataGridTemplateColumn.CellTemplate> <DataTemplate> <Image Source="{Binding EventTypeImage, Mode=OneWay}" HorizontalAlignment="Center" Width="16"/> </DataTemplate> </Controls:DataGridTemplateColumn.CellTemplate> </Controls:DataGridTemplateColumn> <Controls:DataGridTextColumn Header="Source" Binding="{Binding Source, Mode=OneWay}" /> <Controls:DataGridTextColumn Header="Details" MinWidth="175" Binding="{Binding Details, Mode=OneWay}" /> <Controls:DataGridTextColumn Header="Timestamp" MinWidth="175" Binding="{Binding Timestamp, Mode=OneWay}" IsReadOnly="True"/> </Controls:DataGrid.Columns> </Controls:DataGrid>

    Read the article

  • WPF DataGrid window resize does not resize DataGridColumns

    - by skylap
    I have a WPF DataGrid (from the WPFToolkit package) like the following in my application. <Controls:DataGrid> <Controls:DataGrid.Columns> <Controls:DataGridTextColumn Width="1*" Binding="{Binding Path=Column1}" Header="Column 1" /> <Controls:DataGridTextColumn Width="1*" Binding="{Binding Path=Column2}" Header="Column 2" /> <Controls:DataGridTextColumn Width="1*" Binding="{Binding Path=Column3}" Header="Column 3" /> </Controls:DataGrid.Columns> </Controls:DataGrid> The column width should be automatically adjusted such that all three columns fill the width of the grid, so I set Width="1*" on every column. I encountered two problems with this approach. When the ItemsSource of the DataGrid is null or an empty List, the columns won't size to fit the width of the grid but have a fixed width of about 20 pixel. Please see the following picture: http://img169.imageshack.us/img169/3139/initialcolumnwidth.png When I maximize the application window, the columns won't adapt their size but keep their initial size. See the following picture: http://img88.imageshack.us/img88/9362/columnwidthaftermaximiz.png When I resize the application window with the mouse, the columns won't resize. I was able to solve problem #3 by deriving a sub class from DataGrid and override the DataGrid's OnRenderSizeChanged method as follows. protected override void OnRenderSizeChanged(SizeChangedInfo sizeInfo) { base.OnRenderSizeChanged(sizeInfo); foreach (var column in Columns) { var tmp = column.GetValue(DataGridColumn.WidthProperty); column.ClearValue(DataGridColumn.WidthProperty); column.SetValue(DataGridColumn.WidthProperty, tmp); } } Unfortunately this does not solve problems #1 and #2. How can I get rid of them?

    Read the article

  • WPF Toolkit Datagrid - how do you turn selection off?

    - by RodH257
    I have a datagrid in WPF that I am binding to an object. I have a DataGridCheckBoxColumn on there which I want the users to be able to go through and tick the ones they want. Problem is they have to click twice, once for selection then again to check/uncheck. How on earth do you turn this off, I've been searching for way to long to find the answer to this. The datagrid has SelectionMode and SelectionUnit properties - neither of which accept 'none' or 'go away' Any help is appreciated! My code is below for reference <my:DataGrid Margin="15" Name="dgPreview" AutoGenerateColumns="False" CanUserSortColumns="True" CanUserDeleteRows="True" Background="White" ColumnHeaderHeight="20" VerticalScrollBarVisibility="Visible" RowDetailsVisibilityMode="Visible" > <my:DataGrid.Columns> <my:DataGridCheckBoxColumn MinWidth="50" Width="Auto" Header="Include" Binding="{Binding Include}" /> <my:DataGridTextColumn MinWidth="50" Width="Auto" Header="Override #" Binding="{Binding OverrideNumber}" /> <my:DataGridTextColumn MinWidth="220" Width="*" Header="Name" Binding="{Binding Name}" /> <my:DataGridTextColumn MinWidth="50" Width="Auto" IsReadOnly="True" Header="Preview" Binding="{Binding Preview}" /> </my:DataGrid.Columns> </my:DataGrid>

    Read the article

  • Strange Behaviour in DataGrid SilverLight 3 Control

    - by Asim Sajjad
    Here is the my Xaml Code. Here I have changed the Foreground of the cell depending on the current age of the person. <data:DataGridTemplateColumn Header="First Name" Width="150" MinWidth="150" CanUserReorder="False" SortMemberPath="FirstName"> <data:DataGridTemplateColumn.CellTemplate> <DataTemplate > <TextBlock Foreground ="{Binding Path=DateOfBirth,Mode=OneWay,Converter={StaticResource CellColor}}" Text="{Binding FirstName}" ToolTipService.ToolTip="{Binding FirstName}" FontFamily="Arial" FontSize="11" VerticalAlignment="Center" Margin="5,0,0,0" /> </DataTemplate> </data:DataGridTemplateColumn.CellTemplate> </data:DataGridTemplateColumn> <data:DataGridTextColumn Foreground ="{Binding Path=DateOfBirth,Mode=OneWay,Converter={StaticResource CellColor}}" Header="Last Name" Width="150" MinWidth="150" Binding="{Binding LastName}" CanUserSort="True" IsReadOnly="True" CanUserReorder="False"/> When I run the above code it return following Exception AG_E_PARSER_BAD_PROPERTY_VALU My question is that when I remove the Foreground converter from the DataGridTextColumn Column it runs fine As the Foreground converter is applied in the DataGridTemplateColumn Column which will not through excepction. But when I used same Converter to the DataGridTextColumn it throw execption why, can anyone know why is th is behaviour thanks in advance.

    Read the article

  • 2-Way databinding with Entity Framework and WPF DataGrid , is Possible ?

    - by Panindra
    i am working on POS application using SQL CE , WPF , Entity framework 3.5sp2 and iam trying to use data grid as my Order Entry Control for User to enter Products Order . Iam plannning to bind this to enitiy frmae work model , abd looking for 2 way updating ? private void button1_Click(object sender, RoutedEventArgs e) { using (MasterEntities nwEntities = new MasterEntities()) { var users = from d in nwEntities.Companies select new { d.CompanyId, d.CompanyName, d.Place }; listBox1.DataContext = users; dataGrid1.DataContext = users; // foreach (String c in customers) // { // MessageBox.Show(c.ToString()); // } } } When try to double clikc on the datagrid it through s a error with Caption " Invalid Operation Execption was unhandled " and Message " A TwoWay or OneWayToSource binding cannot work on the read-only property 'CompanyId' of type '<f__AnonymousType0`3[System.Int32,System.String,System.String]'. whats wrong here and my xaml coding goes like this <Grid> <ListBox Name="listBox1" ItemsSource="{Binding}" /> <Button Content="Show " Name="button1" Click="button1_Click" /> <DataGrid AutoGenerateColumns="False" Name="dataGrid1" ItemsSource="{Binding}" > <DataGrid.Columns> <DataGridTextColumn Header=" ID" Binding="{Binding CompanyId}"/> <DataGridTextColumn Header="Company Name" Binding="{Binding CompanyName}"/> <DataGridTextColumn Header="Place" Binding="{Binding Place}" /> </DataGrid.Columns> </DataGrid> </Grid> EDITED : i made the changes shown by @vorrtex, But, then i added another button to save the chages and in button click event i added follwing code , butit showing Updating error private void button2_Click(object sender, RoutedEventArgs e) { nwEntities.SaveChanges(); }

    Read the article

  • Silverlight 3 Dynamic DataGrid RowStyle Ignored

    - by antoinne85
    I subclassed the standard DataGrid into SpecialDataGrid so I could override the KeyDown/KeyUp events. Other than that SpecialDataGrid is exactly the same as DataGrid. At run-time I dynamically create a bunch of these SpecialDataGrids. When a user clicks a row in the grid it hightlights, which is fine, but when that grid loses focus, it leaves a residual gray highlight on the last-selected row, which is not fine. I've heavily edited the RowStyle and CellStyle I'm applying to these Grids to more-or-less remove all formatting. I even added a static SpecialDataGrid to the app with test data so I could see if the RowStyle was somehow incorrect, applying the same RowStyle and CellStyle that I'm applying to the dynamically generated one (you'll see it in the code below). What I saw was that the "test grid" showed up exactly as I wanted, and the real grid is ignoring part of the RowStyle! Has anyone run into this issue or have any ideas of how to correct it? Some source and images follow. Creating the SpecialDataGrid: //Set up a datagrid. SpecialDataGrid radio_datagrid = new SpecialDataGrid(); radio_datagrid.ItemsSource = radios; radio_datagrid.AutoGenerateColumns = false; radio_datagrid.HeadersVisibility = DataGridHeadersVisibility.None; radio_datagrid.BorderThickness = new Thickness(0); radio_datagrid.HorizontalAlignment = HorizontalAlignment.Stretch; radio_datagrid.IsReadOnly = true; radio_datagrid.MouseLeftButtonUp += new MouseButtonEventHandler(option_datagrid_MouseLeftButtonUp); radio_datagrid.KeyDown += new KeyEventHandler(radio_datagrid_KeyDown); radio_datagrid.KeyUp += new KeyEventHandler(radio_datagrid_KeyUp); //Radio column. DataGridTemplateColumn temp_col = new DataGridTemplateColumn(); temp_col.CellTemplate = (DataTemplate)this.Resources["RadioColumnTemplate"]; temp_col.Width = new DataGridLength(20); radio_datagrid.Columns.Add(temp_col); //Description column. DataGridTextColumn txt_col = new DataGridTextColumn(); txt_col.Binding = new Binding("optionlabel"); txt_col.Width = new DataGridLength(350); radio_datagrid.Columns.Add(txt_col); //Product code column. txt_col = new DataGridTextColumn(); txt_col.Binding = new Binding("optioncode"); txt_col.Width = new DataGridLength(80); radio_datagrid.Columns.Add(txt_col); //Price column. txt_col = new DataGridTextColumn(); txt_col.Binding = new Binding("optionprice"); txt_col.Width = new DataGridLength(80); radio_datagrid.Columns.Add(txt_col); //View column. temp_col = new DataGridTemplateColumn(); temp_col.CellTemplate = (DataTemplate)this.Resources["HyperlinkButtonColumnTemplate"]; temp_col.Width = new DataGridLength(30); radio_datagrid.Columns.Add(temp_col); radio_datagrid.RowStyle = (Style)this.Resources["StyleDataGridRowNoAlternating"]; radio_datagrid.CellStyle = (Style)this.Resources["Style_DataGridCell_NoHighlight"]; Example Image: The lower DataGrid appears that way regardless of what you do to it. No highlighting of any sort and certainly no residual highlights. Any idea what's keeping this from being applied to the first?

    Read the article

  • events not getting fired properly

    - by prince23
    hi, this is my xaml code. datagrid within another data grid. <sdk:DataGrid x:Name="dgLevel1" AutoGenerateColumns="False" VerticalAlignment="Top" IsReadOnly="True" Margin="12,12,0,0" RowDetailsVisibilityChanged="dgLevel1_RowDetailsVisibilityChanged" SelectionMode="Extended" RowDetailsVisibilityMode="VisibleWhenSelected" Height="412" HorizontalAlignment="Left" Width="816"> <sdk:DataGrid.Columns> <sdk:DataGridTemplateColumn> <sdk:DataGridTemplateColumn.CellTemplate> <DataTemplate> <Button x:Name="myButton" Width="24" Height="24" Click="ExpandLevel1_Click"> <Image x:Name="imgLevel1" Source="Images/detail.JPG" Stretch="None"/> </Button> </DataTemplate> </sdk:DataGridTemplateColumn.CellTemplate> </sdk:DataGridTemplateColumn> <sdk:DataGridTemplateColumn Header="Actual" Visibility="Collapsed"> <sdk:DataGridTemplateColumn.CellTemplate> <DataTemplate > <sdk:Label Content="{Binding UniqueName}" /> </DataTemplate> </sdk:DataGridTemplateColumn.CellTemplate> </sdk:DataGridTemplateColumn> <sdk:DataGridTextColumn Binding="{Binding Name}" Header="Name" Width="550" /> <!--<sdk:DataGridTextColumn Binding="{Binding UniqueName}" Visibility="Collapsed"/>--> <sdk:DataGridTemplateColumn Header="Actual" Width="80" > <sdk:DataGridTemplateColumn.CellTemplate> <DataTemplate > <sdk:Label Content="{Binding Age}" /> </DataTemplate> </sdk:DataGridTemplateColumn.CellTemplate> </sdk:DataGridTemplateColumn> </sdk:DataGrid.Columns> <sdk:DataGrid.RowDetailsTemplate> <DataTemplate> <StackPanel Width="805"> <sdk:DataGrid x:Name="dgLevel2" Width="797" Margin="17,0,0,0" HeadersVisibility ="None" AutoGenerateColumns="False" HorizontalAlignment="Center" IsReadOnly="True" RowDetailsVisibilityChanged="dgLevel2_RowDetailsVisibilityChanged" SelectionMode="Extended" RowDetailsVisibilityMode="VisibleWhenSelected"> <sdk:DataGrid.Columns> <sdk:DataGridTemplateColumn> <sdk:DataGridTemplateColumn.CellTemplate> <DataTemplate> <Button x:Name="myButton" Width="24" Height="30" Click="ExpandLevel2_Click"> <Image x:Name="imgLevel2" Source="Images/detail.JPG" Stretch="None"/> </Button> </DataTemplate> </sdk:DataGridTemplateColumn.CellTemplate> </sdk:DataGridTemplateColumn> <sdk:DataGridTextColumn Binding="{Binding School}" Width="528" /> <sdk:DataGridTextColumn Binding="{Binding College}" Visibility="Collapsed" /> <sdk:DataGridTemplateColumn Header="Actual" Width="80"> <sdk:DataGridTemplateColumn.CellTemplate> <DataTemplate > <sdk:Label Content="{Binding DOB}" /> </DataTemplate> </sdk:DataGridTemplateColumn.CellTemplate> </sdk:DataGridTemplateColumn> </sdk:DataGrid.Columns> </sdk:DataGrid> </StackPanel> </DataTemplate> </sdk:DataGrid.RowDetailsTemplate> </sdk:DataGrid> i have 2 data grid and have 2 image buttons in both the grid . but the event which is in datagrid ExpandLevel1 _Click and ExpandLevel2 _Click is not getting fired properly. some times get fired some times no when i click the button first this event gets fired then ExpandLevel1_Click then **dgLevel1_RowDetailsVisibilityChanged . same thing is happening for the datagrid 2 ExpandLevel2_Click then dgLevel2_RowDetailsVisibilityChanged** there are scenario where first datagrid event gets fired first then button click events why is this happening .is there any solution for this looking forward an solutions thanks in advance. prince

    Read the article

  • Scroll Viewer not visible in wpf DataGrid

    - by cre-johnny07
    I have a datagrid in a grid but the scrollviewer is not visibile even though I made it auto. Below in my code. I can't figure out where's the problem. <Grid Grid.Row="0" Grid.Column="0"> <Grid.RowDefinitions> <RowDefinition Height="Auto" ></RowDefinition> <RowDefinition Height="Auto" ></RowDefinition> <RowDefinition Height="Auto" ></RowDefinition> <RowDefinition Height="Auto" ></RowDefinition> <RowDefinition Height="Auto" ></RowDefinition> <RowDefinition Height="Auto" ></RowDefinition> <RowDefinition Height="Auto" ></RowDefinition> <RowDefinition Height="Auto" ></RowDefinition> <RowDefinition Height="Auto"></RowDefinition> <RowDefinition Height="Auto"></RowDefinition> </Grid.RowDefinitions> <Grid.ColumnDefinitions> <ColumnDefinition Width="Auto"></ColumnDefinition> <ColumnDefinition Width="Auto"></ColumnDefinition> </Grid.ColumnDefinitions> <TextBlock Text="Doctor Name" Grid.Row="0" Grid.Column="0" Margin="5,5,0,0"/> <TextBlock Text="Doctor Address" Grid.Row="1" Grid.Column="0" Margin="5,5,0,0"/> <TextBlock Text="Entry Note" Grid.Row="2" Grid.Column="0" Margin="5,5,0,0"/> <TextBlock Text="Join Date" Grid.Row="3" Grid.Column="0" Margin="5,5,0,0"/> <TextBlock Text="Default Discount" Grid.Row="4" Grid.Column="0" Margin="5,5,0,0"/> <TextBlock Text="Discount Valid Till" Grid.Row="5" Grid.Column="0" Margin="5,5,0,0"/> <TextBlock Text="Employee Name" Grid.Row="6" Grid.Column="0" Margin="5,5,0,0"/> <Grid Grid.Row="7" Grid.Column="0" Grid.ColumnSpan="2"> <Grid.ColumnDefinitions> <ColumnDefinition></ColumnDefinition> <ColumnDefinition></ColumnDefinition> <ColumnDefinition></ColumnDefinition> </Grid.ColumnDefinitions> <TextBlock Text="Report Type" Grid.Row="0" Grid.Column="0" Margin="5,5,0,0"/> <ComboBox Grid.Row="0" Grid.Column="1" Name="cmbReportType" Text="{Binding CurrentEntity.ReportType}"/> <Button Grid.Row="0" Grid.Column="2" Name="btnAddDetail" Content="Add Details" Command="{Binding AddDetailsCommand}"/> </Grid> <TextBox Grid.Row="0" Grid.Column="1" Margin="5,5,0,0" Width="190" Name="txtDocName" Text="{Binding CurrentEntity.RefName}"/> <TextBox Grid.Row="1" Grid.Column="1" Margin="5,5,0,0" Width="190" Height="75" Name="txtDocAddress" Text="{Binding CurrentEntity.RefAddress}"/> <TextBox Grid.Row="2" Grid.Column="1" Margin="5,5,0,0" Width="190" Height="100" Name="txtEntryNote" Text="{Binding CurrentEntity.EntryNotes}"/> <Custom:DatePicker Grid.Row="3" Grid.Column="1" Margin="5,3,0,0" Width="125" Name="dtpJoinDate" Height="24" HorizontalAlignment="Left" VerticalAlignment="Top" SelectedDate="{Binding CurrentEntity.DateStarted}" SelectedDateFormat="Short"/> <TextBox Grid.Row="4" Grid.Column="1" Height="25" Width="75" Name="txtDefaultDiscount" HorizontalAlignment="Left" Margin="5,0,0,0" VerticalAlignment="Top" Text="{Binding CurrentEntity.DefaultDiscount}"/> <Custom:DatePicker Grid.Row="5" Grid.Column="1" Margin="5,3,0,0" Width="125" Name="dtpValidTill" Height="24" HorizontalAlignment="Left" VerticalAlignment="Top" SelectedDate="{Binding CurrentEntity.DefaultDiscountValidTill}" SelectedDateFormat="Short"/> <ComboBox Grid.Row="6" Grid.Column="1" Margin="5,3,0,0" Width="190" Height="30" Name="cmbEmployeeName" ItemsSource="{Binding Employees}" DisplayMemberPath="FullName" SelectedIndex="{Binding SelecteIndex}"> </ComboBox> <Custom:DataGrid Grid.Row="8" Grid.Column="0" Grid.ColumnSpan="2" ItemsSource="{Binding XYZ}" AutoGenerateColumns="False" Name="grdTestDept"> <Custom:DataGrid.Columns> <Custom:DataGridTextColumn Binding="{Binding dep_id}" Width="40" Header="ID"/> <Custom:DataGridTextColumn Binding="{Binding dep_name}" Width="125" Header="Name"/> <Custom:DataGridTextColumn Binding="{Binding default_data}" Width="100" Header="Default Data"/> </Custom:DataGrid.Columns> </Custom:DataGrid> </Grid> <Grid Grid.Row="0" Grid.Column="1" Grid.RowSpan="9"> <Grid.ColumnDefinitions> <ColumnDefinition Width="Auto" MinWidth="43"></ColumnDefinition> <ColumnDefinition Width="Auto" MinWidth="150"></ColumnDefinition> <ColumnDefinition Width="Auto" MinWidth="50"></ColumnDefinition> </Grid.ColumnDefinitions> <Grid.RowDefinitions> <RowDefinition Height="34*" ></RowDefinition> <RowDefinition Height="337.88*"></RowDefinition> </Grid.RowDefinitions> <TextBlock Text="Name: " Grid.Row="0" Grid.Column="0" Margin="5,4,0,0" /> <cc:ValueEnabledCombo Grid.Column="1" x:Name="cmbfilEmployeeName" Width="150" Height="30" Margin="5,4,0,0" VerticalAlignment="Top" SelectedIndex="0" ItemsSource="{Binding Employees}" DisplayMemberPath="FullName" SelectedValuePath="EmployeeId" cc:ValueEnabledCombo.SelectionChanged="{Binding SelectionChangedCommand}"> </cc:ValueEnabledCombo> <Button Grid.Column="2" Name="btnReport" Width="50" Content="Report" Height="28" Margin="5,4,0,0" Command="{Binding ReportCommand}" VerticalAlignment="Top" /> <Grid Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="3"> <Custom:DataGrid ItemsSource="{Binding DoctorList}" AutoGenerateColumns="False" Name="grdDoctor" ScrollViewer.HorizontalScrollBarVisibility="Auto" ScrollViewer.VerticalScrollBarVisibility="Auto"> <Custom:DataGrid.Columns> <Custom:DataGridTextColumn Binding="{Binding RefName}" Width="Auto" Header="Doctor Name"/> <Custom:DataGridTextColumn Binding="{Binding EmployeeFullName}" Width="Auto" Header="Employee Name"/> </Custom:DataGrid.Columns> </Custom:DataGrid> </Grid> </Grid> </Grid>

    Read the article

  • Silverlight DataGrid set cell IsReadOnly programatically

    - by Brandon Montgomery
    I am binding a data grid to a collection of Task objects. A particular column needs some special rules pertaining to editing: <!--Percent Complete--> <data:DataGridTextColumn Header="%" ElementStyle="{StaticResource RightAlignStyle}" Binding="{Binding PercentComplete, Mode=TwoWay, Converter={StaticResource PercentConverter}}" /> What I want to do is set the IsReadOnly property only for each task's percent complete cell based on a property on the actual Task object. I've tried this: <!--Percent Complete--> <data:DataGridTextColumn Header="%" ElementStyle="{StaticResource RightAlignStyle}" Binding="{Binding PercentComplete, Mode=TwoWay, Converter={StaticResource PercentConverter}}" IsReadOnly={Binding IsNotLocalID} /> but apparently you can't bind to the IsReadOnly property on a data grid column. What is the best way do to do what I am trying to do?

    Read the article

  • How do I set the ItemsSource of a DataGrid in XAML?

    - by Ben McCormack
    I'm trying to set the ItemsSource property of a DataGrid named dgIssueSummary to be an ObservableCollection named IssueSummaryList. Currently, everything is working when I set the ItemsSource property in my code-behind: public partial class MainPage : UserControl { private ObservableCollection<IssueSummary> IssueSummaryList = new ObservableCollection<IssueSummary> public MainPage() { InitializeComponent(); dgIssueSummary.ItemsSource = IssueSummaryList } } However, I'd rather set the ItemsSource property in XAML, but I can't get it to work. Here's the XAML code I have: <sdk:DataGrid x:Name="dgIssueSummary" AutoGenerateColumns="False" ItemsSource="{Binding IssueSummaryList}" > <sdk:DataGrid.Columns> <sdk:DataGridTextColumn Binding="{Binding ProblemType}" Header="Problem Type"/> <sdk:DataGridTextColumn Binding="{Binding Count}" Header="Count"/> </sdk:DataGrid.Columns> </sdk:DataGrid> What do I need to do to set the ItemsSource property to be the IssueSummaryList in XAML rather than C#?

    Read the article

< Previous Page | 1 2 3 4  | Next Page >