You would use a CollectionViewSource and use grouping. I assume that you are using WPF. Here is a sample: How to: Sort and Group Data Using a View in XAML - WPF .NET Framework | Microsoft Learn[^]. Hereare some more things that you can do with...
Google will give you lots of articles. Perhaps you should search it before asking quesion. Anyways here is what found for you.Using The Silverlight DataGrid[^]
HiI have a winforms app I'm trying to port to WPF. In that I have a datagridview bound to a bindingsource and use BindingSource.Filter = string.Format("Column LIKE '%{0}%'", tb_Filter.Text);in a textchanged event method to let the user filter the datagrid in real time.I'd like to do...
Not that I would normally do this, I'm actually just goofing around with .NET's DataGridView...but I have class, Person, that has a List as a property.I'm creating a BindingSource with a DataSource=new List();OK, fine, the grid displays the properties in Person. But...
You need to use Office interop. Start here:http://msdn.microsoft.com/en-us/library/bb726434%28v=office.12%29.aspx[^],http://msdn.microsoft.com/en-us/library/microsoft.office.interop.excel%28v=office.14%29.aspx[^].Basically, you start development with "Add Reference". Add a reference from...
Test it:DECLARE @lessons TABLE(LessonID INT IDENTITY(1,1), LessonName VARCHAR(30))INSERT INTO @lessons (LessonName)SELECT 'lesson A'UNION ALL SELECT 'lesson B'UNION ALL SELECT 'lesson C'UNION ALL SELECT 'lesson D'--UNION ALL SELECT 'lesson E'DECLARE @subject_lesson TABLE...
ProblemIt is a typo mistake.SolutionThat is DataSource, not DataSoure.In your code "c" is missing.So. code will be like...protected void Gridview1_PageIndexChanging(object sender, GridViewPageEventArgs e){ GridView1.PageIndex = e.NewPageIndex; GridView1.DataSource =...
Yes, you can sort the values in an Enum for display in a ComboBox alpha-numerically, or any other way you want:// requires Linq// preserve the current ComboBox selectionprivate V currentVName;private void Form1_Load(object sender, EventArgs e){ var vAry =...
There are multiple questions above. To keep it simple, I will try and answer the part about navigation in the MainWindow using the MVVM Design Pattern. I'm sure that there are a lot of people have different ideas on what is the best solution and there are many libraries that implement a variety...
Wel... Start here: Ready-to-use serial port enumeration list box[^] For further details, please see: SerialPort.GetPortNames Method (System.IO.Ports) | Microsoft Docs[^] [EDIT] There's no guarantee that SerialPort.GetPortNames method will return the names of ports. But, there's work-around....
There are problems here with what you want to do: you can't use a single ObservableCollection for two different lists, and while you could put all the items from both into a weakly typed ObservableCollection and cast them appropriately when you...
AFAIK about WPF, there is not much difference in normal Datagrid binding (asp.net) and WPF Datagrid binding when you are doing it on server side. So I hope this link will be useful to you.Binding an ArrayList with DataGrid Control[^]Anurag
Amongst all the tags you applied to your question you forgot to include one for the type of Database (SQL Server, Access, MySQL, ????).Still, one suggestion. If your database allows default values for columns setting that to 0 or any sensible number for your scenario might resolve the...
Hi all,I have a problem with binding a reorder list, the control that is part of the AJAX Control Toolkit. I hope you can help because I've spent hours developing it!I created the list and had it working perfectly, with insert, edit and delete commands, as well as reordering all...
Are you trying to format the text before it's displayed? If so, you're going about it the wrong way. You need to handle the oBinding_Format event:Private Sub oBinding_Format(ByVal sender As Object, ByVal e As System.Windows.Forms.ConvertEventArgs) Handles oBinding.Format e.Value =...
Goto Datagridview Properties --> Columns.Then you will get small window. In the right side you can see 'DataPropertyName' in column properties.For each column set the database column name.Then give AutoGenerateColumns = false.
HiI'm focusing on "The user should be able to change the selected item in FooContainer by changing the selection in the DataGridView."The following solution lets the user select items by clicking the cell, and the following event sets the according item in the bound data collection to...
It took me a little while to spot what is happening. The reason for your problem is you are changing the reference to the CurrentCustomer on the Customers object in a way that won't re-bind the UI. To see what I mean:Have Customers implement the INotifyProperyChanged Interface. I normally do...
HiTo Do this:1. In Windows Forms designer go to combobox properties.2. Find datasource property and expand it3. Click "Add new Project datasource".4. In the wizard select Object and then Next.5. Select Person class in the tree ( if you does not have it try to build project with...
Try this wayList person = new List() { new Person(){Name="Anna", Birthday=new DateTime(2006, 10, 01), Age=12}, new Person(){Name="Ben", Birthday=new DateTime(2006, 11, 02), Age=13}, new Person(){Name="Cora",...
Hi,I'm new to WPF and C#. In my XAML file, I have a simple Rectangle, where I am binding the width and the fill color:When my program loads, I am reading the width and the color from a...
The reason you get a thread error when you update your brush is because all graphical objects are expecting a single threaded always.Now fortunately for you in this case, there is an exception and that is the Freezable class which all brushes inherit from. Those can, after they have been...
Use the SelectedIndex property[^].Once you have the value you have selected, fetch the values related to this index (the ones that you want to show in textboxes).These will need to be fetched from the database or a temporary memory store.Display these values.
HiI may have misunderstood the question. But you should concider using ObservableCollection instead of List when presenting data to the UI, because the ObservableCollection also implements the notification properties notifying changes in the list.Hope it helps :-)
Sorry, this is complete gibberish, see http://en.wikipedia.org/wiki/Gibberish[^].It looks like you don't know what programming does. Why do you think you can change the behavior of program by deleting any lines of code? Delete from what code? Do you know that a program is compiled, so it's...
You can use below code : string myConnection = conn.ConnectionString.ToString();//"Data Source=MDT765;Initial Catalog=TST;User Id=user;Password=user@123;"; SqlDataAdapter sqlcom0 = new SqlDataAdapter("SELECT Id,Name,Pos,Loc FROM Employee", myConnection); ...
Hi All,Now i resolved issue using following code. I have replaced following linetxtTextBox.SetBinding(TextBox.VisibilityProperty, new Binding("Redactable") { Source = this, Converter = new BoolToVisibilityConverterReverse() });with this.MapBinding(RestrictedControl.ValueProperty,...
Hi,After binding your datalist just you need to call the given function below.private void fnChangeLinkStyle(){ foreach (DataListItem dli in DataList1.Items) { if (dli.ItemType == ListItemType.Item || dli.ItemType == ListItemType.AlternatingItem) { ...
dim ds as new dataset dim qry as string = "select * from tabletemp"dim command as sqlcommand = new sqlcommand(qry,connection)dim da as sqldataadapter = new sqldataadapter)command)da.fill(ds,"tabletemp")dim datevariable as stringdatevariable =...
Unfortunately there is no SelectedItem read/write dependency property for WPF. You can create a behaviour to get around this (http://stackoverflow.com/questions/1000040/selecteditem-in-a-wpf-treeview[^]), or use code behind for the SelectedItemChanged. Ideally you should have a view model...
How about...//create a datasource for TreeView or GridView using the xml document in memory.XmlDataSource xmlds = new XmlDataSource();xmlds.Data=xdoc.ToString();xmlsd.ID="SomeGloballyUniqueNameForThisDataSource"; // e.g. "Products"...See also MSDN: XmlDataSource.Data...
Unfortunately yes. If you do not use something like Notify Property Weaver[^] you will need to raise the notify on each property change.If you do not go down the automated route, I would really recommend setting your property value and then raising the changed event on the property setter...
in button click event...if condition should be like belowif AnswerTextbox.Text.ToLower() = yourAnswer.Text.ToLower() thenToLower() will convert both textbox values in lower case and then it will compare themHappy Coding!:)
The issue I see in you code is that you are trying to bind the ItemsSource to use the AvosEntries of your DataContext (which happens to be the collection pointed to by your AvosEntries property). Basically, you are trying to use the AvosEntries property of the AvosEntries collection. I see...
In btnBrowse_Click you set the value of CurrentArticle but the DataContext still keeps the old value...You can set the DataContext too: private void btnBrowse_Click(object sender, RoutedEventArgs e) { //logic for openfiledialog //strFilePath is...
I have found that specific questions related to 3rd party is answered more quickly and accurately at respective forums.Posting such issues about a 3rd party control (Infragistics here) Forum would be more useful, here: Infragistic Forums[^]
I'm going to expand my comment...ItemSource is meant to be bound to an object that supports property change notification. What you should do is implement INotifyPropertyChanged on your class (I'm assuming the code-behind for that page) then add a property for each ItemSource:public...
Imagine the items in triplicate for the different listboxes Source="{Binding Source={x:Static Application.Current}, Path=CurrentList}" x:Key="CurrentList" /> > ...
To anyone that can help or show me a better way. I have tried to do this with an observable collection, a list based on a custom class, global/non-global collections, using the listbox's itemssource, synclocking, and finally emptying and manually entering in items.It tends to work fine, but...
I've seen similar issues, and managed to fix them by re-working the code.The first change I would make would be with these:Try For I = Me.ParentListbox.Items.Count - 1 To 0 Step -1 Me.ParentListbox.Items.RemoveAt(I) NextCatchEnd TryTry For I =...
I have 3 TextBoxes (Id,Name and Salary)Id and salary should be integers and Name is only charecters.I need validations for my TextBox as i enter wrong charecters or integers it should show error and also can i do it this in only xaml without codebehind ? I'm new to Wpf and validation please help...
You can't do this directly.The Window and SecondControl are two different contexts (WPF XAML NameScope) and the ElementName is limited by NameScope."You can refer to elements in code only if they are registered to the appropriate NameScope" MSDN: Binding.ElementName[^]So, I see two...
So, I found a solution for my question here: http://stackoverflow.com/questions/1152128/wpf-databind-to-a-stackpanel-using-datatemplates[^]Replacing the StackPanel with a ContentPresenter and instead of DataContext using the Content property worked for me.Probably it will help someone...
The solution is simple: don't try to load any UI element with that many items.Think about it: how you like to use that software and try to find the one selection you need to use in a list of 200,000 other ones? Every day? Probably several times every day?If I tried that, my users would...
You'll get better results if you bind the list in the Init event of the control, rather than the page.protected void ddlCustomers_Init(object sender, EventArgs e){ var ddl = (DropDownList)sender; ddl.DataSource = SystemData.GetAllCustomers(); ddl.DataTextField =...
Swap the dictionary format. Or I misunderstood the question?Dictionary AccountType = new Dictionary { {0, "no type"}, {1, "basic"}, {2, "derived"} };combo.DataSource = new BindingSource(AccountType, null);combo.DisplayMember =...
Not sure if I understand the question correctly, but you should call OnPropertyChanged only when the value of the property is actually changed and preferably inside the setter of a property and only for that property.Based on your code you call OnPropertyChanged for the FirstName property...
I personally use an event trigger on the event lost focus to do a string.empty check. If the string is empty then I replace it with my default string. I also use the command property to fire the validation in the view model, or you can extend a behavior in the textbox control to do this as well....
Check this: Dim dt As DataTable = New DataTable() dt.Columns.AddRange({New DataColumn("Day", GetType(Int32)), _ New DataColumn("Date", GetType(DateTime)), _ New DataColumn("Room No.", GetType(Int32)), _ New DataColumn("Room Rate", GetType(Double)), _ New DataColumn("No. of...
If i understand you well... i'd suggest to simplify this by using Dictionary class[^]. See: 'define "color translator" ;) Dim ColorTranslator As Dictionary(Of String, Drawing.Color) = New Dictionary(Of String, Drawing.Color) 'add keys and values With ColorTranslator .Add("-1",...
Look at your error message: Exception thrown: 'System.Data.Entity.Core.EntityCommandCompilationException' in EntityFramework.SqlServer.dll Additional information: An error occurred while preparing the command definition. See the inner exception for details. So use the debugger, and look at the...
Well, true is true, false is false and null is null. What this meant to you? You have to handle it. But... please read it before: Nullable Value Types (Visual Basic) | Microsoft Docs[^] Databinding and Nullable types in WinForms.NET[^] How to achieve that? Please, see: Bound CheckBoxes when...
I'm using wpf c# and Entity Framework I have a DataGrid on that show data from database when users click on datagrid that row will show items in ComboBox (Load on of columns in combobox) but problem is combobox doesn't show Normal list...
When you create your "item source collection", assign either the VALUE of "email" OR "address" to the "display field" (column), and just display what's in that column. Easier than what you're trying to do.
Once you add a datagrid, you can label the columns anyway you want and it's possible to foreach over an enum foreach (Suit suit in (Suit[]) Enum.GetValues(typeof(Suit))) { }
Hi, I would like to know how to populate a WPF DataGrid with a list of objects without using data binding and manually defining columns in DataGrid. Also how can you populating a DataGrid from a MySQL or SQL database without using data binding? Is there a way to click on a DataGrid row...
I have two files (1) Access (2) Excel in both there are many records available. There are more than 50000 and I want to find out how many new records are not available in Access which are in Excel. :confused: both files structure are not the same. There is just one identical column in both...
If you mean that you want to provide the contents of the ComboBox dropdown then you need to use the Items property. myComboBox.Items.Add("Some Text"); myComboBox.Items.Add("Some More Text");or string[] items = new string[] { "Some Text", "Some More Text" }; ...
Hi astika,ComboBox will display Text property when you select an item. And SelectedValue, SelectedItem will have value(s) when only if you set DataSource, DisplayMember, ValueMember property. Please try:cbo.DataSource = dataSet;//Or dataTablecbo.DisplayMember =...
I have two list boxes related to each other on the same form. The first is bound to a IEnumberable of MembershipDataViewModel Objects (Essentially Users). I have a fancy Data Template that shows the user, email and whether or not it has been modified and all, it works great. However, i have a...
Hello,I am currently experimenting with databinding.Now there is one problem I cannot seem to fix.I have a DataSet with a DataTable. In this DataTable I have a Column which does not allow null values.Now I have a BindingSource which has the DataSet as its DataSource and the DataTable...
Hi.When I use this select in a entitydatasource.CommandText:CommandText="SELECT it.[LiteratureID], it.[ReleaseDate], it.[Title], it.[Text], it.[ThreadID], it.[Added], (SELECT COUNT(fp.PostID) FROM ForumPosts AS fp WHERE fp.ThreadID = it.[ThreadID] AND fp.Status = 1) AS Posts FROM...
Hi friends, I have a doubt to display the content of the tables in matrix format. I have three different tables (1)Day Order (In this i have the day order details) DayOrder Id ...
Hi dear experts ;)In my WPF app, I have a class called Employee with 2 fields: FirstName, LastName.In my view model, I have two bindable properties:ObservableCollection Employees;int CurrentIndex;I want to bind a TextBlock on my view to the FirstName field of current...
i want data from a label of data list in asp.neti created a template of data list and use a labelafter binding data in label i want to access the value of label
foreach (DataListItem dli in DataList1.Items) { Label Label1 = dli.FindControl("Label1") as Label; string lblValue=Label1.Text;}//In Datalist events.Label Label1 = e.Item.FindControl("Label1") as Label;//can get the value in string...
I suggest reading the documentation on AcceptChanges and Update. Update writes the dirty records in the DataSet/DataTable back to the database. AcceptChanges tells the DataSet/DataTable that the changes that were made are now the current state of the records. The two operations are completely...
Hi, I'm trying to fill a DataGridView with the data taken from a Select.I don't want the columns to be created automatically, I already defined some with styles and all that stuff. However, when defining the datasource, my DataGridView shows the expected number of rows, but empty.If I...
Hi experts,let's assume this codeusing System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Text;using System.Windows.Forms;namespace Test_DataBinding{ public partial class Form1 : Form { ...
I am using a datalist control to show per user comments.there is a comment textbox for showing comment per user in itemtemplate.now when i will click the edit command button i want that comment textbox will be enabled to edit comment text and when update is clicked that user comment will be...