|
|
Here is my setup:
I have a ListBox which contains an ItemTemplate.
The ItemTemplate incorporates a checkbox with name/checked state bound to the ItemSource object.
issue: when the checkbox is checked (or unchecked) the selected event is not picked up. Basically you have to click the checkbox text on the far right to actually select it.
This can be a rather delecate issue as a user may think they are setting values for the item they checked but actually changing values for a previously selected item.
Is there something in the xaml I can set or do I handle the checked event and set that object to selected item?
|
|
|
|
|
If I'm reading correctly - the checkbox button
is eating the mouse click events (like buttons do)
so the listbox selection doesn't change, correct?
If so, I would try adding Checked/Unchecked event
handlers to the CheckBox. In the handlers, the sender
parameter will be the CheckBox. The CheckBox's DataContext
should be a reference to the selected item in the ListBox's
ItemsSource. Set the listBox's SelectedItem property to
the CheckBox's DataContext value.
(Note I didn't test this )
private void CheckBox_Checked(object sender, RoutedEventArgs e)
{
myListBox.SelectedItem = (sender as CheckBox).DataContext;
}
private void CheckBox_Unchecked(object sender, RoutedEventArgs e)
{
myListBox.SelectedItem = (sender as CheckBox).DataContext;
}
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Mark,
Yup, you understood correctly, the checkbox is gobbling up the event and the listbox does not select the item. I pretty much thought I'd have to do what you suggested, setting listbox.SelectedItem to the corresponding checkbox.
Thanks Mark,
Michael
|
|
|
|
|
I added a code sample to my post....does it work?
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
yuppers, that worked.
|
|
|
|
|
Good to know, thanks!
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
|
Hi,
I have created a 3D object in WPF using c#. I would like to make them transparent. I tried reducing the alpha value in color palette. Also, I tried to use Opacity property of Brush(Eg: brush.Opacity = 0.25;). Both of them doesn't seem to work. Could some one give some suggestions. Thanks in advance!!!
|
|
|
|
|
Well the alpha should take care of this for you. You can look at my article on XAML Series 2. It should some alpha blending. Mostly depends on what is being over laid over what. The example is a silverlight applet that uses what I call a sparkel filter, the filter uses different alpha values to create a star burst pattern in a matrix to give the desired effect.
If you want the whole window to be transparent you need to set the aplha values all the way down the widget hierarchy.
|
|
|
|
|
Hi,
I am making a mini paint like application using WPF.. Does anyone know how to go about implementing a Pencil tool in WPF (C# preferred.)
thanks in advance.
|
|
|
|
|
You'd want to draw to a Canvas. A pencil tool would probably best be implemented as a Path. Handle click events and mouse move events to do the drawing.
|
|
|
|
|
I have a problem while add XML data to my WPF application. I try to add data.xml by add an existing file on Solution, it's work.. But while make a link to data.xml on Data Binding, there message appear "An error ocurred while read The XML data source file. The data source could not be created. " Please help me, I'm newbie. I trying to changes the location of data.xml file, but it doesn't work. Thx.
|
|
|
|
|
If the XML isn't well formed, this would be thrown. Are you sure that it is well formed?
"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 | Onyx
|
|
|
|
|
Well, I just followed the step on WPF Data Binding Tutorial. There's a xml file that I should make, I just only changes the location of images (add image on image_form). May be I should compare which one of code xml that was true. I'll check it now, can you teach me more..
modified on Sunday, January 17, 2010 11:05 PM
|
|
|
|
|
I got it.. but there's new problem.. why in my listbox (I put an image) but there's doesn't appear, only code of my images path.. explaind me please..
|
|
|
|
|
Is it possible to get the 2D coordinate position (x,y) of any 3D object (i used WPF to construct the 3D object)?
|
|
|
|
|
In my xaml page I would like to display an image from my C# project's resources folder depending on the value of binded data. To explain it better, I want to display one of three images (information.png, warning.png, or error.png) depending on what type of data it is. Is there a way to make such a conditional statement strictly in XAML markup language? Thanks.
|
|
|
|
|
You would normally do this using a data trigger[^].
"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 | Onyx
|
|
|
|
|
Hi All,
I get that Silverlight has security on reading directories, and that is fully understandable. What I need to do is read the directories on the web site that the silverlight control is hosted in. This will be hosted on my server, so there is no real risk that I will write code that is going to damage my server. I am still new to Silverlight, but not new at all to coding.
I am starting to think that it is impossible to do directly in silverlight. I was thinking that I could write a service that returns the info needed, but that is overkill for what I am doing, and can become a security risk itself.
Please let me know IF I can do it, and how.
Thanks in advance.
Thanks,
Brad
|
|
|
|
|
Member 1269473 wrote: I was thinking that I could write a service that returns the info needed, but that is overkill for what I am doing
Silverlight apps run on the client so there's no way
they can read anything on the server without making a request
to the server.
A web server like IIS can provide directory browsing, but do you really
want to turn that on? Same implications as implementing your own directory
service...
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
No, I definitely don't want to do that.
Looks like I will have to create a WCF Service or something so that I can get the info I want.
It just seems like a PITA to go through to get what I want.
Thanks.
Thanks,
Brad
|
|
|
|
|
Member 1269473 wrote: It just seems like a PITA to go through to get what I want.
Maybe, but that isn't a Silverlight issue - that's web servers.
If everyone wanted their web directories to be browsable then that
feature would be on by default
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hi
I am new wpf and 3D. I want to know how to draw cross section line while mouse enter like (Auto cad) in WPF
Regards
Gopal
|
|
|
|
|
I want to set Rowspan for DataGrid's row using code-behind.
Can anyone please tell me how is it possible?
Thanks,
Dipak
|
|
|
|