how to display an item in combobox from list view?












-1














i have a list view where user can see already stored data.If user clicks a row in that list view the details should be display on its proper control.I done textbox and label part but the data doesnt display in combobox and time picker controls.Please help me



    <Grid  HorizontalAlignment="Center" Margin="64,0,134.4,0" Width="936" Height="778" VerticalAlignment="Top" >

<Grid Margin="26,36,-75,1" />
<StackPanel HorizontalAlignment="Right" Width="479" Name="settingentry" Loaded="settingentry_Loaded" Margin="0,334,423,92" >


<ComboBox x:Name="Usertype" Background="#545d6a" Foreground="#545d6a" Margin="10,0,286,0" FontSize="20" ItemsSource="{Binding}" DataContext="{Binding ElementName=Mylist,Path=SelectedItem}" BorderBrush="Black" />

<xctk:TimePicker Name="fromtimepick" Height="25" Margin="10,0,348,0" Background="#545d6a" Foreground="White" FontWeight="Bold" FontSize="15" FontStretch="SemiExpanded" Format="Custom" FormatString="HH:mm" Value="{Binding Path=StartTime, Mode=TwoWay}"/>

<xctk:TimePicker Height="25" Name="totimepick" Margin="10,0,348,0" Background="#545d6a" Foreground="White" FontWeight="Bold" FontSize="18" FontStretch="SemiExpanded" Format="Custom" FormatString="HH:mm" Value="{Binding Path=EndTime, Mode=TwoWay}"/>


</StackPanel>
<Label Name="getdate" Grid.Column="3" Foreground="White" FontWeight="ExtraBold" FontSize="20" FontStretch="ExtraExpanded" Background="#545d6a" Height="33" HorizontalAlignment="Left" Margin="79,-46,0,0" VerticalAlignment="Top" Loaded="getdate_Loaded" Width="121" />
<ListView Height="252" Margin="513,406,-75,0" VerticalAlignment="Top" Name="Mylist" FontSize="15" FontWeight="ExtraBold" Background="#04c582" Foreground="Black" ItemsSource="{Binding}">
<ListView.View>
<GridView>


<GridViewColumn Header="User Type" DisplayMemberBinding="{Binding Path=usertype}"></GridViewColumn>

<GridViewColumn Header="From" DisplayMemberBinding="{Binding Path=from}"></GridViewColumn>
<GridViewColumn Header="To" DisplayMemberBinding="{Binding Path=to}"></GridViewColumn>


</GridView>
</ListView.View>
</ListView>
</Grid>
</Border>




My dal



private void Submit_Click(object sender, RoutedEventArgs e)
{
// try {



        SqlConnection con = new SqlConnection("server=.\sqlexpress;database=ticket;integrated security=true");
con.Open();

SqlCommand cmd = new SqlCommand("addsettings", con);
cmd.CommandType = CommandType.StoredProcedure;

cmd.Parameters.Add("@ntype", SqlDbType.NChar, 15).Value = nyttype.Content;
cmd.Parameters.Add("@usertype", SqlDbType.NChar).Value = Usertype.Text;
cmd.Parameters.Add("@date", SqlDbType.Date).Value = getdate.Content;
cmd.Parameters.Add("@from", SqlDbType.Time).Value = fromtimepick.Text;
cmd.Parameters.Add("@to", SqlDbType.Time).Value = totimepick.Text;
cmd.Parameters.Add("@money", SqlDbType.Int).Value = amount.Text;

cmd.ExecuteNonQuery();
showdata();
con.Close();
MessageBox.Show("Settings are added");
// }
// catch
// {
MessageBox.Show("please enter somedata or update data");
// }
}
private void getdate_Loaded(object sender, RoutedEventArgs e)
{
DateTime datetime = DateTime.Now;
this.getdate.Content = datetime.ToString("yyyy-MM-dd");
}
public void showdata()
{
SqlConnection con = new SqlConnection("server=.\sqlexpress;database=ticket;integrated security=true");
con.Open();
SqlCommand comm = new SqlCommand("Select *from settings", con);
DataTable dt = new DataTable();
SqlDataAdapter da = new SqlDataAdapter(comm);
da.Fill(dt);
Mylist.DataContext = dt.DefaultView;
}
}


}










share|improve this question
























  • Post your view model and how do you set DataContext.
    – Rekshino
    Dec 28 '18 at 7:32










  • Use an edit link below the post.
    – Rekshino
    Dec 28 '18 at 7:33










  • i posted please help me
    – Soumya
    Dec 28 '18 at 7:34










  • I done textbox and label part Sorry, I havn't found any TextBox in posted code. In ComboBox you are trying to set a single row from DataTable as ItemsSource, which should be a collection. Your code is very messy. My advice - take a look to the MVVM pattern and some examples of it.
    – Rekshino
    Dec 28 '18 at 7:52










  • i hav done label part and textbox.. but i couldnt find combobox..thats y i posted..
    – Soumya
    Dec 28 '18 at 8:44
















-1














i have a list view where user can see already stored data.If user clicks a row in that list view the details should be display on its proper control.I done textbox and label part but the data doesnt display in combobox and time picker controls.Please help me



    <Grid  HorizontalAlignment="Center" Margin="64,0,134.4,0" Width="936" Height="778" VerticalAlignment="Top" >

<Grid Margin="26,36,-75,1" />
<StackPanel HorizontalAlignment="Right" Width="479" Name="settingentry" Loaded="settingentry_Loaded" Margin="0,334,423,92" >


<ComboBox x:Name="Usertype" Background="#545d6a" Foreground="#545d6a" Margin="10,0,286,0" FontSize="20" ItemsSource="{Binding}" DataContext="{Binding ElementName=Mylist,Path=SelectedItem}" BorderBrush="Black" />

<xctk:TimePicker Name="fromtimepick" Height="25" Margin="10,0,348,0" Background="#545d6a" Foreground="White" FontWeight="Bold" FontSize="15" FontStretch="SemiExpanded" Format="Custom" FormatString="HH:mm" Value="{Binding Path=StartTime, Mode=TwoWay}"/>

<xctk:TimePicker Height="25" Name="totimepick" Margin="10,0,348,0" Background="#545d6a" Foreground="White" FontWeight="Bold" FontSize="18" FontStretch="SemiExpanded" Format="Custom" FormatString="HH:mm" Value="{Binding Path=EndTime, Mode=TwoWay}"/>


</StackPanel>
<Label Name="getdate" Grid.Column="3" Foreground="White" FontWeight="ExtraBold" FontSize="20" FontStretch="ExtraExpanded" Background="#545d6a" Height="33" HorizontalAlignment="Left" Margin="79,-46,0,0" VerticalAlignment="Top" Loaded="getdate_Loaded" Width="121" />
<ListView Height="252" Margin="513,406,-75,0" VerticalAlignment="Top" Name="Mylist" FontSize="15" FontWeight="ExtraBold" Background="#04c582" Foreground="Black" ItemsSource="{Binding}">
<ListView.View>
<GridView>


<GridViewColumn Header="User Type" DisplayMemberBinding="{Binding Path=usertype}"></GridViewColumn>

<GridViewColumn Header="From" DisplayMemberBinding="{Binding Path=from}"></GridViewColumn>
<GridViewColumn Header="To" DisplayMemberBinding="{Binding Path=to}"></GridViewColumn>


</GridView>
</ListView.View>
</ListView>
</Grid>
</Border>




My dal



private void Submit_Click(object sender, RoutedEventArgs e)
{
// try {



        SqlConnection con = new SqlConnection("server=.\sqlexpress;database=ticket;integrated security=true");
con.Open();

SqlCommand cmd = new SqlCommand("addsettings", con);
cmd.CommandType = CommandType.StoredProcedure;

cmd.Parameters.Add("@ntype", SqlDbType.NChar, 15).Value = nyttype.Content;
cmd.Parameters.Add("@usertype", SqlDbType.NChar).Value = Usertype.Text;
cmd.Parameters.Add("@date", SqlDbType.Date).Value = getdate.Content;
cmd.Parameters.Add("@from", SqlDbType.Time).Value = fromtimepick.Text;
cmd.Parameters.Add("@to", SqlDbType.Time).Value = totimepick.Text;
cmd.Parameters.Add("@money", SqlDbType.Int).Value = amount.Text;

cmd.ExecuteNonQuery();
showdata();
con.Close();
MessageBox.Show("Settings are added");
// }
// catch
// {
MessageBox.Show("please enter somedata or update data");
// }
}
private void getdate_Loaded(object sender, RoutedEventArgs e)
{
DateTime datetime = DateTime.Now;
this.getdate.Content = datetime.ToString("yyyy-MM-dd");
}
public void showdata()
{
SqlConnection con = new SqlConnection("server=.\sqlexpress;database=ticket;integrated security=true");
con.Open();
SqlCommand comm = new SqlCommand("Select *from settings", con);
DataTable dt = new DataTable();
SqlDataAdapter da = new SqlDataAdapter(comm);
da.Fill(dt);
Mylist.DataContext = dt.DefaultView;
}
}


}










share|improve this question
























  • Post your view model and how do you set DataContext.
    – Rekshino
    Dec 28 '18 at 7:32










  • Use an edit link below the post.
    – Rekshino
    Dec 28 '18 at 7:33










  • i posted please help me
    – Soumya
    Dec 28 '18 at 7:34










  • I done textbox and label part Sorry, I havn't found any TextBox in posted code. In ComboBox you are trying to set a single row from DataTable as ItemsSource, which should be a collection. Your code is very messy. My advice - take a look to the MVVM pattern and some examples of it.
    – Rekshino
    Dec 28 '18 at 7:52










  • i hav done label part and textbox.. but i couldnt find combobox..thats y i posted..
    – Soumya
    Dec 28 '18 at 8:44














-1












-1








-1







i have a list view where user can see already stored data.If user clicks a row in that list view the details should be display on its proper control.I done textbox and label part but the data doesnt display in combobox and time picker controls.Please help me



    <Grid  HorizontalAlignment="Center" Margin="64,0,134.4,0" Width="936" Height="778" VerticalAlignment="Top" >

<Grid Margin="26,36,-75,1" />
<StackPanel HorizontalAlignment="Right" Width="479" Name="settingentry" Loaded="settingentry_Loaded" Margin="0,334,423,92" >


<ComboBox x:Name="Usertype" Background="#545d6a" Foreground="#545d6a" Margin="10,0,286,0" FontSize="20" ItemsSource="{Binding}" DataContext="{Binding ElementName=Mylist,Path=SelectedItem}" BorderBrush="Black" />

<xctk:TimePicker Name="fromtimepick" Height="25" Margin="10,0,348,0" Background="#545d6a" Foreground="White" FontWeight="Bold" FontSize="15" FontStretch="SemiExpanded" Format="Custom" FormatString="HH:mm" Value="{Binding Path=StartTime, Mode=TwoWay}"/>

<xctk:TimePicker Height="25" Name="totimepick" Margin="10,0,348,0" Background="#545d6a" Foreground="White" FontWeight="Bold" FontSize="18" FontStretch="SemiExpanded" Format="Custom" FormatString="HH:mm" Value="{Binding Path=EndTime, Mode=TwoWay}"/>


</StackPanel>
<Label Name="getdate" Grid.Column="3" Foreground="White" FontWeight="ExtraBold" FontSize="20" FontStretch="ExtraExpanded" Background="#545d6a" Height="33" HorizontalAlignment="Left" Margin="79,-46,0,0" VerticalAlignment="Top" Loaded="getdate_Loaded" Width="121" />
<ListView Height="252" Margin="513,406,-75,0" VerticalAlignment="Top" Name="Mylist" FontSize="15" FontWeight="ExtraBold" Background="#04c582" Foreground="Black" ItemsSource="{Binding}">
<ListView.View>
<GridView>


<GridViewColumn Header="User Type" DisplayMemberBinding="{Binding Path=usertype}"></GridViewColumn>

<GridViewColumn Header="From" DisplayMemberBinding="{Binding Path=from}"></GridViewColumn>
<GridViewColumn Header="To" DisplayMemberBinding="{Binding Path=to}"></GridViewColumn>


</GridView>
</ListView.View>
</ListView>
</Grid>
</Border>




My dal



private void Submit_Click(object sender, RoutedEventArgs e)
{
// try {



        SqlConnection con = new SqlConnection("server=.\sqlexpress;database=ticket;integrated security=true");
con.Open();

SqlCommand cmd = new SqlCommand("addsettings", con);
cmd.CommandType = CommandType.StoredProcedure;

cmd.Parameters.Add("@ntype", SqlDbType.NChar, 15).Value = nyttype.Content;
cmd.Parameters.Add("@usertype", SqlDbType.NChar).Value = Usertype.Text;
cmd.Parameters.Add("@date", SqlDbType.Date).Value = getdate.Content;
cmd.Parameters.Add("@from", SqlDbType.Time).Value = fromtimepick.Text;
cmd.Parameters.Add("@to", SqlDbType.Time).Value = totimepick.Text;
cmd.Parameters.Add("@money", SqlDbType.Int).Value = amount.Text;

cmd.ExecuteNonQuery();
showdata();
con.Close();
MessageBox.Show("Settings are added");
// }
// catch
// {
MessageBox.Show("please enter somedata or update data");
// }
}
private void getdate_Loaded(object sender, RoutedEventArgs e)
{
DateTime datetime = DateTime.Now;
this.getdate.Content = datetime.ToString("yyyy-MM-dd");
}
public void showdata()
{
SqlConnection con = new SqlConnection("server=.\sqlexpress;database=ticket;integrated security=true");
con.Open();
SqlCommand comm = new SqlCommand("Select *from settings", con);
DataTable dt = new DataTable();
SqlDataAdapter da = new SqlDataAdapter(comm);
da.Fill(dt);
Mylist.DataContext = dt.DefaultView;
}
}


}










share|improve this question















i have a list view where user can see already stored data.If user clicks a row in that list view the details should be display on its proper control.I done textbox and label part but the data doesnt display in combobox and time picker controls.Please help me



    <Grid  HorizontalAlignment="Center" Margin="64,0,134.4,0" Width="936" Height="778" VerticalAlignment="Top" >

<Grid Margin="26,36,-75,1" />
<StackPanel HorizontalAlignment="Right" Width="479" Name="settingentry" Loaded="settingentry_Loaded" Margin="0,334,423,92" >


<ComboBox x:Name="Usertype" Background="#545d6a" Foreground="#545d6a" Margin="10,0,286,0" FontSize="20" ItemsSource="{Binding}" DataContext="{Binding ElementName=Mylist,Path=SelectedItem}" BorderBrush="Black" />

<xctk:TimePicker Name="fromtimepick" Height="25" Margin="10,0,348,0" Background="#545d6a" Foreground="White" FontWeight="Bold" FontSize="15" FontStretch="SemiExpanded" Format="Custom" FormatString="HH:mm" Value="{Binding Path=StartTime, Mode=TwoWay}"/>

<xctk:TimePicker Height="25" Name="totimepick" Margin="10,0,348,0" Background="#545d6a" Foreground="White" FontWeight="Bold" FontSize="18" FontStretch="SemiExpanded" Format="Custom" FormatString="HH:mm" Value="{Binding Path=EndTime, Mode=TwoWay}"/>


</StackPanel>
<Label Name="getdate" Grid.Column="3" Foreground="White" FontWeight="ExtraBold" FontSize="20" FontStretch="ExtraExpanded" Background="#545d6a" Height="33" HorizontalAlignment="Left" Margin="79,-46,0,0" VerticalAlignment="Top" Loaded="getdate_Loaded" Width="121" />
<ListView Height="252" Margin="513,406,-75,0" VerticalAlignment="Top" Name="Mylist" FontSize="15" FontWeight="ExtraBold" Background="#04c582" Foreground="Black" ItemsSource="{Binding}">
<ListView.View>
<GridView>


<GridViewColumn Header="User Type" DisplayMemberBinding="{Binding Path=usertype}"></GridViewColumn>

<GridViewColumn Header="From" DisplayMemberBinding="{Binding Path=from}"></GridViewColumn>
<GridViewColumn Header="To" DisplayMemberBinding="{Binding Path=to}"></GridViewColumn>


</GridView>
</ListView.View>
</ListView>
</Grid>
</Border>




My dal



private void Submit_Click(object sender, RoutedEventArgs e)
{
// try {



        SqlConnection con = new SqlConnection("server=.\sqlexpress;database=ticket;integrated security=true");
con.Open();

SqlCommand cmd = new SqlCommand("addsettings", con);
cmd.CommandType = CommandType.StoredProcedure;

cmd.Parameters.Add("@ntype", SqlDbType.NChar, 15).Value = nyttype.Content;
cmd.Parameters.Add("@usertype", SqlDbType.NChar).Value = Usertype.Text;
cmd.Parameters.Add("@date", SqlDbType.Date).Value = getdate.Content;
cmd.Parameters.Add("@from", SqlDbType.Time).Value = fromtimepick.Text;
cmd.Parameters.Add("@to", SqlDbType.Time).Value = totimepick.Text;
cmd.Parameters.Add("@money", SqlDbType.Int).Value = amount.Text;

cmd.ExecuteNonQuery();
showdata();
con.Close();
MessageBox.Show("Settings are added");
// }
// catch
// {
MessageBox.Show("please enter somedata or update data");
// }
}
private void getdate_Loaded(object sender, RoutedEventArgs e)
{
DateTime datetime = DateTime.Now;
this.getdate.Content = datetime.ToString("yyyy-MM-dd");
}
public void showdata()
{
SqlConnection con = new SqlConnection("server=.\sqlexpress;database=ticket;integrated security=true");
con.Open();
SqlCommand comm = new SqlCommand("Select *from settings", con);
DataTable dt = new DataTable();
SqlDataAdapter da = new SqlDataAdapter(comm);
da.Fill(dt);
Mylist.DataContext = dt.DefaultView;
}
}


}







wpf wpf-controls wpfdatagrid wpftoolkit






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Dec 28 '18 at 7:34







Soumya

















asked Dec 28 '18 at 5:24









SoumyaSoumya

11




11












  • Post your view model and how do you set DataContext.
    – Rekshino
    Dec 28 '18 at 7:32










  • Use an edit link below the post.
    – Rekshino
    Dec 28 '18 at 7:33










  • i posted please help me
    – Soumya
    Dec 28 '18 at 7:34










  • I done textbox and label part Sorry, I havn't found any TextBox in posted code. In ComboBox you are trying to set a single row from DataTable as ItemsSource, which should be a collection. Your code is very messy. My advice - take a look to the MVVM pattern and some examples of it.
    – Rekshino
    Dec 28 '18 at 7:52










  • i hav done label part and textbox.. but i couldnt find combobox..thats y i posted..
    – Soumya
    Dec 28 '18 at 8:44


















  • Post your view model and how do you set DataContext.
    – Rekshino
    Dec 28 '18 at 7:32










  • Use an edit link below the post.
    – Rekshino
    Dec 28 '18 at 7:33










  • i posted please help me
    – Soumya
    Dec 28 '18 at 7:34










  • I done textbox and label part Sorry, I havn't found any TextBox in posted code. In ComboBox you are trying to set a single row from DataTable as ItemsSource, which should be a collection. Your code is very messy. My advice - take a look to the MVVM pattern and some examples of it.
    – Rekshino
    Dec 28 '18 at 7:52










  • i hav done label part and textbox.. but i couldnt find combobox..thats y i posted..
    – Soumya
    Dec 28 '18 at 8:44
















Post your view model and how do you set DataContext.
– Rekshino
Dec 28 '18 at 7:32




Post your view model and how do you set DataContext.
– Rekshino
Dec 28 '18 at 7:32












Use an edit link below the post.
– Rekshino
Dec 28 '18 at 7:33




Use an edit link below the post.
– Rekshino
Dec 28 '18 at 7:33












i posted please help me
– Soumya
Dec 28 '18 at 7:34




i posted please help me
– Soumya
Dec 28 '18 at 7:34












I done textbox and label part Sorry, I havn't found any TextBox in posted code. In ComboBox you are trying to set a single row from DataTable as ItemsSource, which should be a collection. Your code is very messy. My advice - take a look to the MVVM pattern and some examples of it.
– Rekshino
Dec 28 '18 at 7:52




I done textbox and label part Sorry, I havn't found any TextBox in posted code. In ComboBox you are trying to set a single row from DataTable as ItemsSource, which should be a collection. Your code is very messy. My advice - take a look to the MVVM pattern and some examples of it.
– Rekshino
Dec 28 '18 at 7:52












i hav done label part and textbox.. but i couldnt find combobox..thats y i posted..
– Soumya
Dec 28 '18 at 8:44




i hav done label part and textbox.. but i couldnt find combobox..thats y i posted..
– Soumya
Dec 28 '18 at 8:44












1 Answer
1






active

oldest

votes


















0














I think the problem is on the binding of the date picker,
Please pay attention that you are using the SelectedItem for the Combobox but doesn't use it on the datepicker.



The proper way is to bind the SelectedItem to a property and then bind the property to the Combobox and Datepicker's.



Please notice that you don't use the OnPropertyChanged (Or at least i didn't saw you did), In case the data will change the combobox will not be aware of it.



Hope that it helped
Asaf






share|improve this answer





















  • actually that is not a date-picker or combobox.. that is time picker.. thank u for ur response
    – Soumya
    Dec 29 '18 at 9:07










  • Hi Soumya, In case the answer worked for you - Can you mark it as one ?
    – Asaf
    Dec 30 '18 at 5:12











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53954020%2fhow-to-display-an-item-in-combobox-from-list-view%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









0














I think the problem is on the binding of the date picker,
Please pay attention that you are using the SelectedItem for the Combobox but doesn't use it on the datepicker.



The proper way is to bind the SelectedItem to a property and then bind the property to the Combobox and Datepicker's.



Please notice that you don't use the OnPropertyChanged (Or at least i didn't saw you did), In case the data will change the combobox will not be aware of it.



Hope that it helped
Asaf






share|improve this answer





















  • actually that is not a date-picker or combobox.. that is time picker.. thank u for ur response
    – Soumya
    Dec 29 '18 at 9:07










  • Hi Soumya, In case the answer worked for you - Can you mark it as one ?
    – Asaf
    Dec 30 '18 at 5:12
















0














I think the problem is on the binding of the date picker,
Please pay attention that you are using the SelectedItem for the Combobox but doesn't use it on the datepicker.



The proper way is to bind the SelectedItem to a property and then bind the property to the Combobox and Datepicker's.



Please notice that you don't use the OnPropertyChanged (Or at least i didn't saw you did), In case the data will change the combobox will not be aware of it.



Hope that it helped
Asaf






share|improve this answer





















  • actually that is not a date-picker or combobox.. that is time picker.. thank u for ur response
    – Soumya
    Dec 29 '18 at 9:07










  • Hi Soumya, In case the answer worked for you - Can you mark it as one ?
    – Asaf
    Dec 30 '18 at 5:12














0












0








0






I think the problem is on the binding of the date picker,
Please pay attention that you are using the SelectedItem for the Combobox but doesn't use it on the datepicker.



The proper way is to bind the SelectedItem to a property and then bind the property to the Combobox and Datepicker's.



Please notice that you don't use the OnPropertyChanged (Or at least i didn't saw you did), In case the data will change the combobox will not be aware of it.



Hope that it helped
Asaf






share|improve this answer












I think the problem is on the binding of the date picker,
Please pay attention that you are using the SelectedItem for the Combobox but doesn't use it on the datepicker.



The proper way is to bind the SelectedItem to a property and then bind the property to the Combobox and Datepicker's.



Please notice that you don't use the OnPropertyChanged (Or at least i didn't saw you did), In case the data will change the combobox will not be aware of it.



Hope that it helped
Asaf







share|improve this answer












share|improve this answer



share|improve this answer










answered Dec 28 '18 at 14:08









AsafAsaf

452




452












  • actually that is not a date-picker or combobox.. that is time picker.. thank u for ur response
    – Soumya
    Dec 29 '18 at 9:07










  • Hi Soumya, In case the answer worked for you - Can you mark it as one ?
    – Asaf
    Dec 30 '18 at 5:12


















  • actually that is not a date-picker or combobox.. that is time picker.. thank u for ur response
    – Soumya
    Dec 29 '18 at 9:07










  • Hi Soumya, In case the answer worked for you - Can you mark it as one ?
    – Asaf
    Dec 30 '18 at 5:12
















actually that is not a date-picker or combobox.. that is time picker.. thank u for ur response
– Soumya
Dec 29 '18 at 9:07




actually that is not a date-picker or combobox.. that is time picker.. thank u for ur response
– Soumya
Dec 29 '18 at 9:07












Hi Soumya, In case the answer worked for you - Can you mark it as one ?
– Asaf
Dec 30 '18 at 5:12




Hi Soumya, In case the answer worked for you - Can you mark it as one ?
– Asaf
Dec 30 '18 at 5:12


















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53954020%2fhow-to-display-an-item-in-combobox-from-list-view%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Mossoró

Error while reading .h5 file using the rhdf5 package in R

Pushsharp Apns notification error: 'InvalidToken'