Set ItemsSource="{Binding}" for datagrid, and populate it with setting .DataContext = ObservableColelction, instead of setting ItemsSource
wpf,datagrid,datepicker,datatemplate,controltemplate
https://connect.microsoft.com/VisualStudio/feedback/details/1291078 <DatePicker DisplayDate={Binding Path=DisplayDate} Loaded="DatePicker_Loaded" /> and add to the code: private void DatePicker_Loaded(object sender, RoutedEventArgs e) { DatePicker dp = sender as DatePicker; if (dp != null) { dp.ClearValue(DatePicker.DisplayDateProperty); } } ...
The gray rectangle is the so called row Header. By default the DataGrid turns on row and column header. You turn it off the row header by setting HeadersVisibility=Column So, you don't need a template to get that done....
List<List<string>> lstStrings = new List<List<string>>{ new List<string>() {"A1","A2","A3"}, new List<string> {"B1","B2","B3"}, new List<string> {"C1","C2","C3"} }; List<List<string>> newList = new List<List<string>>(); int j=0; foreach(String s in lstStrings[0]) { List<string> innerList = new List<string>(); for(int i=0;i<lstStrings.Count;i++) { innerList.Add(lstStrings[i][j]); } j++; newList.Add(innerList); } foreach(List<string> lstInner in newList)...
If you want to create a "pivot table" from your database table to bind to a grid view, the easiest way I know of is to use a DataTable as the binding source and use a LINQ query to get the information to populate it. So we basically need to...
As Eugene mentioned, you'll want to use a converter. First, you'll want to add a class that implements IValueConverter: public class DateTimeFormatConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { var dateValue = value as DateTime?; if (dateValue != null) { var diff =...
Welcome to StackOverflow! Usually people won't answer questions without the following. A clear summary of what you're attempting to do. All of the relevant code Any exceptions that you are experiencing All of the research links you used in order to get where you are That said, I will give...
wpf,linq,entity-framework,datagrid,dataset
By default, the AutoGenerateColumns property of a DataGrid is true, which will cause it to append all of the columns to the end of whatever you've specified directly. Just set that to false and you should be good to go. <DataGrid Name="dataGridDomaines" Grid.Row="4" IsReadOnly="True" ItemsSource="{Binding}" AutoGenerateColumns="false"> <DataGrid.Columns> <DataGridTextColumn Header="Nom Domaine"...
wpf,mvvm,data-binding,datagrid,mvvm-light
Try setting AutoGenerateColumns to False <DataGrid x:Name="LevelConfigurationDataGrid" AutoGenerateColumns="False" Grid.Column="1" Grid.Row="1" Margin="20,0" ItemsSource="{Binding LevelConfigs}"> <DataGrid.Columns> ... </DataGrid.Columns> </DataGrid> ...
Some things are tough to bind because they are not part of the Visual tree, such as popups or in your case - datagrid headers. A well known workaround is to use Josh Smith's DataContextSpy. Basically you instantiate it as a resource and give it the binding. Then use that...
You shouldn't bind the UI to a property in the view model that always gives a new value. This is why your original version works. Adding and removing items from the observable collection should update the UI as it implements INotifyCollectionChanged. So keep a single observable collection, bind it to...
wpf,xaml,mvvm,datagrid,listbox
Here's what I would do. Create a property in your ViewModel which will hold the SelectedItem. private YourTypeHere _SelectedThing; public YourTypeHere SelectedThing { get { return _SelectedThing; } set { _SelectedThing = value; //Call INotifyPropertyChanged stuff } } Now, bind your SelectedItem for your List to this property: <ListBox SelectedItem="{Binding...
Gabriel mentioned that this behavior is a known issue that raises when you try to create a brand-new style for data grid (or in general any item collection). I tried creating an style based on default style as suggested by Gabriel like following: <Style TargetType="{x:Type DataGrid}" BasedOn="{StaticResource {x:Type DataGrid}}"> <Setter...
Try using a DataTrigger with predefined DataTemplate items: <DataTemplate x:Key="OneItem" DataType="{x:Type ValueItem}" > <TextBox Text="{TemplateBinding Id}" /> </DataTemplate> <DataTemplate x:Key="MultiItems" DataType="{x:Type ValueItem}" > <ComboBox ItemsSource="{TemplateBinding ValueItems}" DisplayMemberPath="ValueName" SelectedValuePath="ID" SelectedValue="{TemplateBinding Id}" /> </DataTemplate> And then use a Content control to place the style accordingly. I haven't tried this but your data...
Assuming the UI for your DataGrid is something like this: <DataGrid Name="dataGridPrincipal" Grid.Row="0" ItemsSource="{Binding MyList}" SelectedItem="{Binding MyItem , Mode=TwoWay}" /> and the code behind is as follow: public ObservableCollection<Customer> MyList { get; set; } public Customer MyItem { get; set; } // with INotifyPropertyChanged implemented public MainWindow() { InitializeComponent(); MyList...
Your class should contain Properties, not Variables. The DataGrid will only look for public properties instead of public variables. See here, and here...
It'd be easy if you create a Customer ViewModel class with Name and Location property and create an ObservableCollection<Customer> customersand set that as the ItemsSource for the datagrid and use it to bind the columns. public class Customer { public string Name {get; set;} public string Location {get; set;} }...
Try setting the SelectedItem property. Preserve what was selected before and set the SelectedItem with what was previously selected in your event. Something like this: private void DgDataGrid_OnSelectedCellsChanged(object sender, SelectedCellsChangedEventArgs e) { int newIndex = (sender as DataGrid).SelectedIndex / 2; if (Convert.ToInt32(newIndex) >= 1) (sender as DataGrid).SelectedItem = previous; else...
As its name hints, the CellEditEnding event gets fired right before the edit is commited. Sadly, since there is no CellEditEnded event, there's no straightforward way to do what you want. You have three options here: Set the cell's Bindings UpdateSourceTrigger to PropertyChanged, so the changes are applied on the...
c#,wpf,datagrid,triggers,datagridcell
I would add an EventSetter in a Style like this : <DataGrid.Resources> <Style TargetType="{x:Type DataGridCell}"> <EventSetter Event="MouseEnter" Handler="EventSetter_OnHandler"/> </Style> </DataGrid.Resources> Here is the handler: private void EventSetter_OnHandler(object sender, MouseEventArgs e) { DataGridCell dgc = sender as DataGridCell; TextBox tb = Utils.GetChildOfType<TextBox>(dgc); tb.Focus(); } In fact you said you want to...
First of all, you should consider using WPF with at least a bit of MVVM pattern. It means you're gonna provide DataContext class for your View (V) called ViewModel(VM). We're gonna move all the data we will later on bind controls to there. ViewModel: public class ViewModel { public DataTable...
You can't access DataGridCell.Content that way, use a DataTrigger instead based on your DataGrid.SelectedItem.YourProperty like this: <DataGrid.CellStyle> <Style TargetType="DataGridCell"> <Setter Property="FontWeight" Value="Bold" /> <Style.Triggers> <DataTrigger Binding="{Binding YourProperty}" Value="0"> <Setter Property="FontWeight" Value="Normal"/> </DataTrigger> </Style.Triggers> </Style> </DataGrid.CellStyle> EDIT: Assuming your DataGridColumns are text-based then you can...
As @David suggested if you want relevant helpful answers post us compilable accurate code. This is just a guess based off how I format my DataRow output when I need it to be altered. Try to format the syntax before you do your table.Rows.Add() So instead of doing this foreach...
Please don't use WPF as if it were Windows Forms... it's not Windows Forms. In WPF, we use the DataGrid by loading data in a suitable form into a property and data bind that property to the DataGrid.ItemsSource property like this: <DataGrid ItemsSource="{Binding YourCollectionProperty}" ... /> ... // preferably implement...
c#,wpf,xaml,datagrid,custom-controls
I had to remove the section from the Generic.xaml style for the DataGrid to properly layout and created the column in code. protected override void OnInitialized(EventArgs e) { base.OnInitialized(e); CloneColumn.Visibility = ShowCloneColumn ? Visibility.Visible : Visibility.Hidden; } private DataGridTemplateColumn _cloneColumn; private DataGridTemplateColumn CloneColumn { get { if (_cloneColumn == null)...
c#,asp.net,checkbox,datagrid,webforms
I use this to do the same thing. You should be able to do the same thing slightly modifying fieldnames. CheckBox chkStatus = (CheckBox)sender; GridViewRow row = (GridViewRow)chkStatus.NamingContainer; string cid = row.Cells[1].Text; bool status = chkStatus.Checked; //Connection & Call go here com.Parameters.Add("@Approved", SqlDbType.Bit).Value = status; com.Parameters.Add("@CategoryID", SqlDbType.Int).Value = cid; ...
Whenever the GUI thread blocks and the application freezes, I would recommend refactoring to use async/await. Essentially, you can push the heavy lifting onto a background thread using something like var result = await Task.Run (() => { return MySlowMethod();});. result is a List<T>, and MySlowMethod is some slow method,...
It is probably just recycling for speed Try VirtualizingStackPanel.VirtualizationMode="Standard"...
The technology (VB6) is indeed very old; you can try something like Sub AddSymbol() For i = 1 To DataGrid1.Rows If DataGrid1.Item(i, 2) = 1 Then DataGrid1.Item(i, 2) = "*" Next i End Sub where quantity is stored in the second column of DataGrid1 control. Hope this may help....
I've played a bit here, nothing spectacular but is a working version: <Style TargetType="DataGridCell"> <EventSetter Event="Selected" Handler="EventSetter_OnHandlerSelected"/> <EventSetter Event="LostFocus" Handler="EventSetter_OnHandlerLostFocus"/> </Style> This is the codebehind: private void EventSetter_OnHandlerSelected(object sender, RoutedEventArgs e) { DataGridRow dgr = FindParent<DataGridRow>(sender as DataGridCell); dgr.Background = new SolidColorBrush(Colors.Red); } private void...
ruby-on-rails,ruby,ruby-on-rails-4,datagrid
I found the solution: I had to add :html => true to column(:avatar, :html => true). This way html code such as link_to work and I also no longer needed ActionController::Base.helpers to get access to the image_tage method.
I would split the state-stuff you're adding using ko.extenders... the problem is that the editvalue observable doesn't initialize until you click the edit button so it doesn't work the first time you click it, but does work after that. In theory, everything you're trying to do should be done entirely...
From your screenshot it does not seems the TextBlock are "slightly on the right" (they touch the left border). Do you want to get rid of the "row selector", the small gray button on the left? If so set HeadersVisibility="Column" in XAML.
i would change your code to <Grid Margin="10"> <DataGrid ItemsSource="{Binding EntityList}" AutoGenerateColumns="False"> <DataGrid.Columns> <DataGridTextColumn Header="Id" Binding="{Binding Id}" /> <DataGridTextColumn Header="Last Name" Binding="{Binding LastName}" /> <DataGridTextColumn Header="First Name" Binding="{Binding FirstName}" /> <DataGridTextColumn Header="Middle Name" Binding="{Binding MiddleName}" /> <DataGridCheckBoxColumn Header="Status" Binding="{Binding StatusId}" />...
You Button's DataContext is the DataItem of the DataGridRow it is in . <Button Command="{Binding Path=DataContext.DeleteStorage, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type DataGrid}}}"> ...
Xaml: <Window x:Class="WpfApplication1.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="MainWindow" Height="350" Width="525" xmlns:local="clr-namespace:WpfApplication1" > <Window.DataContext> <local:MyViewModel/> </Window.DataContext> <Window.Resources> <local:BooleanToTextConverter x:Key="booleanToTextConverter" /> <local:BoolToColorConverter x:Key="booleanToColorConverter" />...
One minor mistake made by you in CustonDatagrid.xaml <DataGrid ItemsSource="{Binding ElementName=CustonDataGrid, Path=Colection}" DockPanel.Dock="Top"></DataGrid> There is no element called CustonDataGrid because of which the elements were never reflected. Changed it to <DataGrid ItemsSource="{Binding Path=Colection}"></DataGrid> I also made minor change in your MainWindow.cs public partial class MainWindow : Window { public MainWindow()...
c#,wpf,datagrid,rowdetailstemplate
Assuming you name your DataGrid dataGrid, then this is what you need: private void check_Click(object sender, RoutedEventArgs e) { DataGridRow dgRow = (DataGridRow)(dataGrid.ItemContainerGenerator.ContainerFromItem(dataGrid.SelectedItem)); if (dgRow == null) return; DataGridDetailsPresenter dgdPresenter = FindVisualChild<DataGridDetailsPresenter>(dgRow); DataTemplate template = dgdPresenter.ContentTemplate; TextBox textBox = (TextBox)template.FindName("toCheck", dgdPresenter); string needCheck = textBox.Text; if (needCheck == "abc") {...
It seems like AirplaneID is readonly. Either make it writeable or change the binding to OneWay.
It's because you're passing your data in the wrong way to the view. Instead of return view('welcome',$grid); You should be doing: return view('welcome')->with('grid', $grid); or return view('welcome', ['grid' => $grid]); ...
Here is the solution that works: private void tabControlOrganizer_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (tabControlOrganizer.SelectedItem != null) { if (e.Source is TabControl) { if (tabItemTrades.IsSelected) { dataGridTrades.ItemsSource = Queries.GetTradeList(dataContext); } SelectionChanged was the problem: In C# WPF, why is my TabControl's SelectionChanged event firing too often? In free time I...
When i am binding a datagrid in wpf using mvvm rather than looking at it as a collection of rows and columns i see it as a collection of objects - each row represents an individual object, and each column represents a property of that object. So in your case,...
The problem here is that you are assigning null value to float, which is not a nullable type (see Nullable Types). Either use float? or change the way that you assign the value, so that you handle the case when it is null....
Do not use DataRowView ... that is not relevant for WPF's DataGrid. You must be thinking of a different framework. If you are populating the data on your DataGrid simply by setting the ItemsSource property to a collection of objects that you got from your Linq code, then the type...
c#,.net,wpf,datagrid,itemcontainergenerator
The ItemContainerGenerator.Items seems to be present in .NET 4.0: https://msdn.microsoft.com/en-us/library/system.windows.controls.datagrid_properties(v=vs.100).aspx .NET Framework 4 Other Versions ... ItemContainerGenerator Gets the ItemContainerGenerator that is associated with the control. (Inherited from ItemsControl.) ...
The following should work. For example for your first item of the subcollection. Or you could try out binding the entire subcollection to a combobox? <DataGrid.Columns> <DataGridTextColumn Header="item" Binding="{Binding Name}" /> <DataGridTextColumn Header="subitems" Binding="{Binding ListSpecs[0]}" /> // first item of subcollection <DataGridTextColumn Header="subitems" Binding="{Binding ListSpecs[1]}" /> // second item of...
You need to expose your ObservableCollection as a Property, not a Field. public class MainViewModel { public ObservableCollection<OptionStrike> oOs { get; set; } public MainViewModel() { oOs = new ObservableCollection<OptionStrike>(new OptionStrike[] { new OptionStrike("Put", 7500.00, 12345), new OptionStrike("Call", 7500.00, 123), new OptionStrike("Put", 8000.00, 23645), new OptionStrike("Call", 8000.00,99999) }); } }...
c#,wpf,user-interface,mvvm,datagrid
You can define another Model and ViewModel for Process Options, and then in the SamplesAnalyzeCommand, display the ProcessOptionsView. When user is done with the ProcessOptionsView, the main ViewModel gets notified (e.g by an event handler) and completes the Process. Something like this: internal class SamplesAnalyzeCommand : ICommand { ... public...
You need to handle the ItemCommand event. Change OnSelectedIndexChanged="EditItem" to OnEditCommand="EditItem". Or you could just remove it from markup and add a handles clause like below: Protected Sub EditItem(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs) Handles dgrdItem.ItemCommand If e.CommandName = "Edit" ... End Sub ...
You dont need to use a converter for doing this calculation. Hope you can handle it in Model Class. Also You need to bind to property. DataGrid binding property Names are not correct c# is case sensitive. Refer my below code. <DataGrid x:Name="dgr" AutoGenerateColumns="False" ItemsSource="{Binding LoadDataBinding}"> <DataGrid.Columns> <DataGridTextColumn Binding="{Binding Path=PrecioGram,...
Well, the problem is, that the cells are rendered at the moment you scroll to them. First the checkbox appears, then the selection value. As described in smooth scrolling, you could try to set ScrollViewer.CanContentScroll=False which would draw your whole list at once (and deactivates the virtualization of the contents)...
If they are all related, why are you even having three different lists? They should also live together. I mean create a class with all necessary properties. public class TemperatureEntity { public double Temperature {get; set;} public DateTime Time {get; set;} public string Rate{get; set;}//string or whatever type it is...
try to dispatch an event when user set alarm...and add a listener of this event in your renderer, so when a new alarm is set, an event will be dispatched from your alarm interface, and be captured in your renderer which will update your icon style.
Does this work...? <DataGrid x:Name="CurrentConfigDataGrid" ItemsSource="{Binding}" > <DataGrid.Resources> <ResourceDictionary Source="../ResourceDictionaries/MergedDictionary.xaml" /> <Style TargetType="TextBlock" BasedOn="{StaticResource {x:Type TextBlock}}" /> </DataGrid.Resources> ... Technically, if you create a Style in your Resources, with no Key but with a TargetType, it should be applied automatically to all controls of that type that have no explicit...
You tell DataGrid to take all available space inside the FlowPanel. Then you tell Grid widget to do the same. The result is that your Grid has a height of zero, since there was no space left for it after the DataGrid took 100% of the FlowPanel height. You either...
html,asp.net,visual-studio,drop-down-menu,datagrid
You should use TemplateColumn, when it comes to DataGrid as it is inherited from System.Web.UI.WebControls.DataGridColumn. TemplateField is inherited from System.Web.UI.WebControls.DataControlField, which make sense with GridView....
This part of your code SELECT 2010,2011 From the manual http://dev.mysql.com/doc/refman/5.1/en/identifiers.html "Identifiers may begin with a digit but unless quoted may not consist solely of digits." wrap those column names in ticks. SELECT `2010`,`2011` Since you didn't post your error message. Sidenote: Copy/paste it from this answer. Ticks and regular...
c#,.net,wpf,datagrid,wpfdatagrid
DataGridColumns are not FrameworkElements so they do not have a ContextMenu. Since you want to do this all in code behind specifying a data template for the column can be a pain (IMHO). You could try passing in a FrameworkElement as the Header object for the column and set the...
Solved the issue doing this: 1) Adding this: public DataTable StatisticsDataTable { get; private set; } 2) Then changing my method part here: StatisticsDataTable = dt; GridStatistics.DataContext = StatisticsDataTable; 3) The XAML binding became the following: ItemsSource="{Binding}" Thanks everyone who tried to help!...
wpf,xaml,binding,datagrid,notify
I would have done the converting from item to tooltip content in a dependency property in the item's datacontext. Therefore, when the process is finished you Raise property change of this "ToolTipContent" property, and thats it. In the property's Set you should create the content.
Solved it. I had to add a OnPropertyChanged("IdentificationCompanyType"); into the setter of the IdentificationCompanyType in the Identification class. After that it got automatically updated in the DataGrid....
Datagrid has two styles horizontalSeparatorSkin and verticalSeparatorSkin style which you can override. It seems you need to override the later. <mx:DataGrid id="grid" verticalGridLines="true" verticalSeparatorSkin="{VerticalSeparatorSkin}"> <mx:columns> <mx:DataGridColumn dataField="lbl" /> <mx:DataGridColumn dataField="val"/> </mx:columns> </mx:DataGrid> Now you can write this class as: public class VerticalSeparatorSkin extends ProgrammaticSkin { public function VerticalSeparatorSkin() { super();...
c#,html,asp.net,drop-down-menu,datagrid
First of all add one hidden field control in data-grid for save the location Id of the row. After that when bind the drop-down you need to get the value from hidden field and set in drop-down as below. <asp:DataGrid runat="server" CssClass="tblResults" OnItemDataBound="dgList_ItemCreated" OnRowDataBound="OnRowDataBound" AllowSorting="true" OnSortCommand="dgTrailer_Sort" ID="dgTrailers" DataKeyField="ID" AutoGenerateColumns="false"> <HeaderStyle...
Look at this: DataGrid CurrentItem != SelectedItem after reentry with tab-button First of all a row is selected by the user which makes the datagrid show that row in the selected way (SelectedItem and also CurrentItem contain the selected object). Then the focus is given to another control. In this...
vb.net,datagridview,datagrid,datepicker
Take a look at the DataView.RowFilter property. This allows you to filter data in your DataGridView, using expressions. ' Set the data source. MyDataGridView.DataSource = myDataTable ' Set the filter. DirectCast(MyDataGridView.DataSource, DataTable).DefaultView.RowFilter = String.Format("DateColumn = '{0:yyyy-MM-dd}'", MyDateTimePicker.Value) ...
You can bind the PropertyGroup to the TextBox as Tag, then you can read it in the event handler and check the property group name: <DataGrid Name="propertyGrid"> <DataGrid.Columns> <DataGridTemplateColumn Header="Property Group Name"> <DataGridTemplateColumn.CellTemplate> <DataTemplate> <TextBlock Text="{Binding propertyGroupName}" /> </DataTemplate> </DataGridTemplateColumn.CellTemplate> </DataGridTemplateColumn> <DataGridTemplateColumn Header="Property 1">...
Your code works fine with Loaded event but at the moment you set AutoGenerateColumns="False" and don't define columns. You need to either define columns manually <DataGrid AutoGenerateColumns="False" ... Loaded="dataGrid1_Loaded"> <DataGrid.Columns> <DataGridTextColumn Binding="{Binding Name}" Header="Name"/> <DataGridTextColumn Binding="{Binding Value}" Header="Value"/> </DataGrid.Columns> </DataGrid> or let it auto generate columns <DataGrid AutoGenerateColumns="True" ... Loaded="dataGrid1_Loaded"/>...
ruby-on-rails,ruby,ruby-on-rails-4,datagrid
This DataGrid seems to be set up more or less like a Model class, and I think that's an important hint that they're serious about object orientation and encapsulation: the innards of the class won't automatically have access to the outside world, you need to manually specify the info you...
if what you have are DataGridViewTextBoxCells instead of TextBoxes you could use this method static bool IsAnyCellEmpty(DataGridView gridView, params int[] columnIndexes) { bool result = false; foreach (DataGridViewRow row in gridView.Rows) { foreach (var index in columnIndexes) { if (row.Cells[index].Value.ToString().Trim().Length == 0) { result = true; break; } } }...
Okey, let me clear up some confusion before we proceed: Since the columns are dynamic and are only known in runtime, I need to create an entity whose attributes can be set in run time. Not necessarily, you can use a list of objects. I thought of converting my ProdCatList...
I have been trying another solution for your problem. <Style x:Key="DataGridCellStyle" TargetType="{x:Type DataGridCell}"> <Style.Triggers> <DataTrigger Binding="{Binding Path=., RelativeSource={RelativeSource Self}, Converter={StaticResource DataGridCellToBooleanConverter}, ConverterParameter=IsEnabled}" Value="True"> <Setter Property="Background" Value="Yellow"/> </DataTrigger> </Style.Triggers> </Style> <DataGrid CellStyle="{StaticResource DataGridCellStyle}">...
It's important that all the members you show are public, if not they won't be visible in the grid. Try creating a public get method to your properties if you don't have one. EDIT: <DataGrid Name="DataGrid1" AutoGenerateColumns="False" "> <DataGrid.Columns> <DataGridTextColumn Header="Name" Binding="{Binding Path=Name}" Width="*"/> </DataGrid.Columns> </DataGrid> Public class Person {...
wpf,datagrid,resize,datagridtextcolumn
Turn out it is quite easy: <DataGridTextColumn Header="URL" Binding="{Binding Path=url}"> <DataGridTextColumn.ElementStyle> <Style TargetType="TextBlock"> <Setter Property="HorizontalAlignment" Value="Right"/> </Style> </DataGridTextColumn.ElementStyle> </DataGridTextColumn> ...
You need to take away the string format at the parent level (which is overriding the EditingElementStyle) - and instead set the string format for the binding expression only in the styles for EditingElementStyle - but also for the regular ElementStyle (non-editing mode) which is a TextBlock style: <DataGridTextColumn Header="s"...
sorting,extjs,datagrid,extjs4.2
You should use the sortType configuration in your model's field definition, i.e. a function that returns the value used for sorting. Example configuration: fields: [ // ... other fields ... { name: 'AbsChange', sortType: function(value) { return Math.abs(value); } } ] ...
Due to the way DataGridColumns are implemented, binding to parent viewmodels are always problematic. The reason you are getting the binding error is because the row is bound to Person, and Person does not have the Names property. The names property occur on MyViewModel and can be accessed like this...
By default PowerShell 2.0 will use .NET framework 2.0. There is no DataGrid in .NET v 2.0. Type : [environment]::Version If you get this, or something else starting with 2... Major Minor Build Revision ----- ----- ----- -------- 2 0 50727 7905 Your PowerShell session is using NET 2.0. How...
c#,wpf,mvvm,data-binding,datagrid
First thing, as you are using MVVM, so you will have to notify your properties by implementing INotifyPropertyChanged interface. Second from the Setter of your SelectedItem property you will have to notify your WorkItems property as well, so that when you change the date from dropdown, it will also update...
c#,wpf,data-binding,datagrid,observablecollection
With the new code provided, it looks like you'd just need to add a PropertyChanged notification for the PostBack property. Since that property is calculated, it won't be recalculated automatically unless you notify it's changed. And you should do so in the Ticker setter because PostBack depends on its value....
symfony2,vector,datagrid,doctrine2
I ended up using an Entity source instead of a Vector, and because the data was from a stored procedure/native query, it was imposible for doctrine to find me the current row with the id, so my client ended up creating a new stored procedure that uses the row id...
Your Converter code will be called when you will notify the Issues property. So try to notify Issue property whenever you are adding/removing any item to that collection. I think it should work.
Just set the ItemControl's Content property: <ContentControl Content="{Binding}"> WPF will automatically set DataTemplate's DataContext to its parent ContentControl's Content. But in your XAML you don't set the Content property (you only specify ContentControl's Style, but forget to set its Content). And don't forget to set UpdateSourceTrigger=PropertyChanged on your control bindings,...
As it turned out, I've been using the wrong approach. You have to use CellTemplate instead of the EditSettings: <dxg:GridColumn.CellTemplate> <DataTemplate> <dxe:ButtonEdit Name="PART_Editor" AllowDefaultButton="False"> <dxe:ButtonEdit.Buttons> <dxe:ButtonInfo Content="X"/> </dxe:ButtonEdit.Buttons> </dxe:ButtonEdit> </DataTemplate> </dxg:GridColumn.CellTemplate> ...
The DataGridViewCellEventArgs argument contains all you need here; private void dataGridView1_CellValueChanged(object sender, DataGridViewCellEventArgs e) { if (dataGridView1.Columns[e.ColumnIndex].Name == "Version") { dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Style.BackColor = Color.AliceBlue; } } ...
asp.net,css3,datagrid,html-table,internet-explorer-10
Try changing your css selector to be something like table.maintbl tbody tr:first-child In your original selector, it was looking for the .maintbl element, then a child table element, then tbody, then tr. Now it is looking for a table element with the .maintbl class (and then looking for child elements...
Is it possible that your datagridview isn't loaded fully when you try to recolor the rows? Since you are setting the datasource, you should put your code that affects the grid after you can make sure that it is finished loading. The column widths change because it is not dependent...
Assuming each Object[] (in other words each row) consist of two strings then this is what you need: <DataGrid AutoGenerateColumns="False" ItemsSource="{Binding YourList}"> <DataGrid.Columns> <DataGridTextColumn Header="Date" Binding="{Binding [0]}" /> <DataGridTextColumn Header="Time" Binding="{Binding [1]}" /> </DataGrid.Columns> </DataGrid> ...
flex,datagrid,itemrenderer,dataprovider
Have not used Flex 3 since long but can you once check that whether ItemRenderer supports boolean property rendererIsEditor? If yes then set it to true then your renderer will also work as editor. EDIT: I tried your code now and there seems to be some compiler error with delcaration...
You need to remove element from your data source, which is in this case DataTable dt. Just use the following code to remove selected row from the table: private void DeleteRow(object sender, RoutedEventArgs e) { dt.Rows.RemoveAt(DataGrid1.SelectedIndex); } ...
c#,asp.net,sql-server,datagrid
After working on this for a while more I was finally able to complete the changes necessary. OnItemDataBound worked for me, allowing me to make the changes while the data was in the process of binding. Each case had to be checked so the label would correctly display the information...
asp.net,vb.net,gridview,datagrid,footable
Even if it's harder to implement the FooTable plugin with the DataGrid than with a GridView, it does not means it's not possible. If you read a little bit the FooTable introduction page, you realize that this plugin works with the HTML table element. So, no matter the control you...
Just revisited the code and found that I was not updating the SelectedItems IList: Dispatcher.BeginInvoke(new Action(delegate { foreach (var item in e.RemovedItems) { SelectedItems.Add(item); } SelectedItemsList.Add(SelectedItem); }), System.Windows.Threading.DispatcherPriority.ContextIdle, null); ...
c#,wpf,mvvm,datagrid,imultivalueconverter
The weirdness of that design aside... No, you cannot The signature of Convert is: Object Convert( Object[] values, Type targetType, Object parameter, CultureInfo culture ) (MSDN) So you have to return a single object. That object could even be a Tuple<string, object> which would approximate multiple return values, but thats...
c#,asp.net,data-binding,datagrid
Page.DataBind() calls DataBind on it's children, so it updates DocumentTitle in the text box but it also DataBinds your grid. I didn't see a DataSource set in your grid, like an EntityDataSource, so I am assuming you are doing the smart retrieving (and preparation) of the data yourself in code...