|
It work's fine on my machine - proper index and no multiselection. This is what I am using,
<ListBox Name="mulList" MouseDoubleClick="ListBox_MouseDoubleClick" SelectionMode="Single">
<ListBoxItem Content="Item 0"/>
<ListBoxItem Content="Item 1"/>
<ListBoxItem Content="Item 2"/>
<ListBoxItem Content="Item 3"/>
<ListBoxItem Content="Item 3"/>
<ListBoxItem Content="Item 2"/>
</ListBox>
private void ListBox_MouseDoubleClick(object sender, MouseButtonEventArgs e)
{
MessageBox.Show("item " + (sender as ListBox).SelectedIndex.ToString() + " was selected.");
MessageBox.Show("item " + mulList.SelectedIndex.ToString() + " was selected.");
}
|
|
|
|
|
Forgive me, but I'm still a little green with WPF. Your method worked fine for me when I added ListBoxItems at design time.
I was adding string items to the ListBox at runtime by:
ListBox1.Items.Clear();
for (int i = 0; i << listOfNames.count(); i++)
{
ListBox1.Items.Add(listOfNames.name[i]);
}
If I create a ListBoxItem and set it's content to the name and then add it, that worked:
ListBox1.Items.Clear();
for (int i = 0; i << listOfNames.count(); i++)
{
ListBoxItem listBoxItem = new ListBoxItem();
listBoxItem.Content = listOfNames.name[i];
ListBox1.Items.Add(listBoxItem);
}
I was using ListBox1.SelectedItem to return the value (in my case name) of what was selected. Now I have to create a ListBoxItem, set it to the SeletecdItem, and then grab the content. So much for thinking it was simple.
Thanks again for your help.
Brad
"You know you're a geek when... You try to shoo a fly away from the monitor with your cursor. That just happened to me. It was scary." — Juuso Heimonen.
|
|
|
|
|
I have the same problem. I think it's a bug in WPF.
I'm using .NET 4.0 Beta 2 on VS2010 and I'm on Windows 7RC. The application itself is targeting .NET 3.0.
|
|
|
|
|
Hi All,
I keep seeing examples using this method but I simply cannot find it on the Dispatcher in my UI controls ... has this been deprecated in 3.5 SP1 or something??
Cheers,
|
|
|
|
|
|
|
This method has deliberately been hidden by Microsoft - they state that it's an advanced method that should only be used with care. We had lengthy discussions in the WPF Disciples about this issue.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys
|
|
|
|
|
Gotcha. Thanks Pete ... do you have a link to that discussion?
Cheers,
|
|
|
|
|
You can find more info here[^].
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys
|
|
|
|
|
Hi!
I want to display or to show, in a WPF Application, a window in TabItem,
can somebody tell me how to do this.
Because it doesn`t work in the same way like in the winforms application.
thanks
Jeton!
|
|
|
|
|
jear77 wrote: a window in TabItem
I seriously doubt you can do that. See here[^]
jear77 wrote: Because it doesn`t work in the same way like in the winforms application
What ?
Could you elaborate what you are trying to achieve ?
|
|
|
|
|
Hello.
Beyond have a second 'blank' storyboard which is called when a storyboard completes, is there a way to reset the current board back to the start when it's done?
I have been tasked with creating a crazy complex UI design which uses a massive amount of animations created in Blend (if we had a TweenMax for WPF it's be two lines of code!), most of these animations need to reset to the start after they are through, and I'm loathed to create dozens of extra animations or put in alpha and then re-shift-back-to-the-start key frames on everything.
Regards, E.
|
|
|
|
|
|
Hi
Is there any way in silverlight to export the grid as PDF?
Is there any dll that will help?
Thanks in Advance
|
|
|
|
|
Currently, you pretty much need to do that on a server.
AFAIK there's no support for rendering UI elements to a bitmap in Silverlight 2.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Mark is 100 % correct, just grab your data send it to the server using a WCF service, in for instance XML format (just an string), and use any of the well know tools, isharptext I think it's free, then you have tall pdf, ...
HTH
Braulio
/// -------------------------
Braulio Díez
DBSchemaEditor.com
Free Silverlight based DB Schema Modeling Tool
/// -------------------------
|
|
|
|
|
The requirement is to in a tree view there two child nodes dragging the elements of 2 to second child node dynamically.
Ch.Gayatri Subudhi
|
|
|
|
|
Good. So you've got your requirements sorted out. Now, was there a question in there somewhere?
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys
|
|
|
|
|
i m not able to get ur answer.
ch.Gayatri Subudhi
|
|
|
|
|
Ch.Gayatri Subudhi wrote: i m not able to get ur answer.
Probably because you didn't actually ask a question - you only made a statement.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys
|
|
|
|
|
How to put the drag and drop function in a treeview using asp.net with c#.net.
that dynamically dragging the elements from one node to another in a treeview.
plz give me suggestion.
Wts events are working for that?
Ch.Gayatri subudhi
|
|
|
|
|
You need to capture the mouse down and mouse up events. Drag & drop is not supported directly. If you google drag and drop silverlight, you will find plenty of information.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys
|
|
|
|
|
|
What? I'm sorry but I didn't understand any of that question. Could you form the words fully please - I don't read text speak, and I ignore questions that are like this. Plus, it's considered bad form to say that it's urgent - if it's that urgent, you should pay for a support call; this is a volunteer only forum.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys
|
|
|
|
|