Click here to Skip to main content
15,881,204 members
Home / Discussions / WPF
   

WPF

 
AnswerRe: Validation in WPF Pin
Super Lloyd18-Dec-18 13:09
Super Lloyd18-Dec-18 13:09 
AnswerRe: Validation in WPF Pin
Gerry Schmitz23-Dec-18 8:57
mveGerry Schmitz23-Dec-18 8:57 
QuestionI dont now what is the error "{"An ItemsControl is inconsistent with its items source.\n See the inner exception for more information."}" Pin
Rabee3-F1.78754516-Dec-18 2:01
Rabee3-F1.78754516-Dec-18 2:01 
AnswerRe: I dont now what is the error "{"An ItemsControl is inconsistent with its items source.\n See the inner exception for more information."}" Pin
Super Lloyd16-Dec-18 15:50
Super Lloyd16-Dec-18 15:50 
GeneralRe: I dont now what is the error "{"An ItemsControl is inconsistent with its items source.\n See the inner exception for more information."}" Pin
Rabee3-F1.78754517-Dec-18 10:22
Rabee3-F1.78754517-Dec-18 10:22 
GeneralRe: I dont now what is the error "{"An ItemsControl is inconsistent with its items source.\n See the inner exception for more information."}" Pin
Super Lloyd17-Dec-18 15:28
Super Lloyd17-Dec-18 15:28 
AnswerRe: I dont now what is the error "{"An ItemsControl is inconsistent with its items source.\n See the inner exception for more information."}" Pin
Richard Deeming17-Dec-18 9:20
mveRichard Deeming17-Dec-18 9:20 
QuestionI dont now what is the error "{"An ItemsControl is inconsistent with its items source.\n See the inner exception for more information."}" Pin
Rabee3-F1.78754516-Dec-18 1:34
Rabee3-F1.78754516-Dec-18 1:34 
XML Code
<DataGrid Grid.Column="1" x:Name="GrdInsCardsLookup" AutoGenerateColumns="False" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" MaxWidth="600" Margin="3,6,3,-1" Background="{x:Null}">
               <DataGrid.BorderBrush>
                   <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                       <GradientStop Color="Black" Offset="0"/>
                       <GradientStop Color="#FFE22020" Offset="1"/>
                   </LinearGradientBrush>
               </DataGrid.BorderBrush>

               <DataGrid.Columns>

                   <DataGridTextColumn Header="ID"  Width="130"  Binding="{Binding NationalId}"/>
                   <DataGridTextColumn Header="Name"  Width="140" Binding="{Binding Name}"/>
                   <DataGridTextColumn Header="Phone" Width="120" Binding="{Binding Phone}"/>
                   <DataGridTextColumn Header="City" Width="100" Binding="{Binding City}"/>

               </DataGrid.Columns>

           </DataGrid>


C# Code

public DataSet AllInsDataSet = new DataSet();
public List<Instructer> InstructersByName = new List<Instructer>();


private void FillInsList() //2-Step Get Instructers List with there cities names from SQl Server
       {
           AllInsDataSet.Clear();
           var con1 = new SqlConnection(Connectionstring);
           SqlCommand cmd1;
           cmd1 =
               new SqlCommand(
                   "SELECT S1.[ins_id],S1.[ins_national_id],S1.[fname] as FName,S1.[father_name] as 'FatherName',S1.[lname] as 'LName',S1.[city_id],C1.[city],S1.[address],S1.[email],S1.[phone],S1.[mobile],S1.[birthday],S1.[pic_id],S1.[folder_id],S1.[other] FROM [DB_SchoolManager].[dbo].[tbl_ins_cards] S1 Inner Join [DB_SchoolManager].[dbo].[tbl_cities] C1 on S1.city_id=C1.city_id",
                   con1);
           SqlDataAdapter da1;
           da1 = new SqlDataAdapter(cmd1);
           da1.Fill(AllInsDataSet);
       }


private void FillLookupInsGrdByName(string name)
       {
           InstructersByName.Clear();
           GrdStuCardsLookup.ItemsSource = InstructersByName;
           string upname = name.ToUpper();

           for (int i = 0; i < AllInsDataSet.Tables[0].Rows.Count; i++)
           {
               if (((AllInsDataSet.Tables[0].Rows[i][2] + " " + AllInsDataSet.Tables[0].Rows[i][3] + " " + AllInsDataSet.Tables[0].Rows[i][4]).ToUpper()).Contains(upname))
               {
                   InstructersByName.Add(new Instructer()
                   {
                       Id = int.Parse(AllInsDataSet.Tables[0].Rows[i][0].ToString()),
                       NationalId = AllInsDataSet.Tables[0].Rows[i][1].ToString(),
                       Name = AllInsDataSet.Tables[0].Rows[i][2] + " " + AllInsDataSet.Tables[0].Rows[i][3] + " " + AllInsDataSet.Tables[0].Rows[i][4],
                       City = AllInsDataSet.Tables[0].Rows[i][6].ToString(),
                       Phone = AllInsDataSet.Tables[0].Rows[i][9].ToString(),
                       Picid = AllInsDataSet.Tables[0].Rows[i][12].ToString(),
                       Folder = AllInsDataSet.Tables[0].Rows[i][13].ToString()
                   });
               }
           }

           GrdInsCardsLookup.ItemsSource = InstructersByName;


       }



public class Instructer
 {
     public int Id { set; get; }
     public string NationalId { set; get; }
     public string Name { set; get; }
     public string Fname { set; get; }
     public string Lname { set; get; }
     public string FatherName { set; get; }
     public int Cityid { set; get; }
     public string City { set; get; }
     public string Address { set; get; }
     public string Email { set; get; }
     public string Phone { set; get; }
     public string Mobile { set; get; }
     public DateTime Birthday { set; get; }
     public string Picid { set; get; }
     public string Folder { set; get; }
 }


modified 16-Dec-18 7:53am.

QuestionReorder Elements in ScrollViewer/Grid Pin
GenJerDan12-Dec-18 9:38
GenJerDan12-Dec-18 9:38 
AnswerRe: Reorder Elements in ScrollViewer/Grid Pin
Super Lloyd12-Dec-18 18:11
Super Lloyd12-Dec-18 18:11 
GeneralRe: Reorder Elements in ScrollViewer/Grid Pin
GenJerDan12-Dec-18 19:27
GenJerDan12-Dec-18 19:27 
QuestionBorder With Bound Pulsating Color Pin
Kevin Marois10-Dec-18 5:53
professionalKevin Marois10-Dec-18 5:53 
AnswerRe: Border With Bound Pulsating Color Pin
Super Lloyd12-Dec-18 17:06
Super Lloyd12-Dec-18 17:06 
QuestionBinding To Single List Item Pin
Kevin Marois27-Nov-18 10:23
professionalKevin Marois27-Nov-18 10:23 
AnswerRe: Binding To Single List Item Pin
Meshack Musundi27-Nov-18 20:17
professionalMeshack Musundi27-Nov-18 20:17 
GeneralRe: Binding To Single List Item Pin
Pete O'Hanlon27-Nov-18 21:03
mvePete O'Hanlon27-Nov-18 21:03 
GeneralRe: Binding To Single List Item Pin
Meshack Musundi27-Nov-18 21:12
professionalMeshack Musundi27-Nov-18 21:12 
GeneralRe: Binding To Single List Item Pin
Pete O'Hanlon27-Nov-18 22:19
mvePete O'Hanlon27-Nov-18 22:19 
GeneralRe: Binding To Single List Item Pin
Meshack Musundi27-Nov-18 21:24
professionalMeshack Musundi27-Nov-18 21:24 
GeneralRe: Binding To Single List Item Pin
Pete O'Hanlon27-Nov-18 22:18
mvePete O'Hanlon27-Nov-18 22:18 
GeneralRe: Binding To Single List Item Pin
Meshack Musundi27-Nov-18 22:45
professionalMeshack Musundi27-Nov-18 22:45 
GeneralRe: Binding To Single List Item Pin
Pete O'Hanlon27-Nov-18 23:11
mvePete O'Hanlon27-Nov-18 23:11 
AnswerRe: Binding To Single List Item Pin
Pete O'Hanlon27-Nov-18 21:01
mvePete O'Hanlon27-Nov-18 21:01 
AnswerRe: Binding To Single List Item Pin
Gerry Schmitz28-Nov-18 19:46
mveGerry Schmitz28-Nov-18 19:46 
Question(solved) Drag and Drop problem Pin
Super Lloyd20-Nov-18 23:36
Super Lloyd20-Nov-18 23:36 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.