|
Use CellTemplate rather than DisplayMemberBinding.
Also, I highly recommend downloading the WPF Toolkit to use the DataGrid rather than the ListView. The DataGrid makes customizing visuals much easier. I believe it also has some additional options for sizing columns (percent, auto, etc.). You might also look at this quick stack overflow discussion of the advantages of using DataGrid.
|
|
|
|
|
|
Hey,
I want to have some surface on which the user can click, after which I get the coordinates so I can store them somewhere, and draw something on that location.
I've found ways to let a user draw on something, but not how to effectively get the coordinates. This is vital for the application I want to create though.
This is a C# application working with .Net 4.0 beta 2 and a WPF interface.
Any pointers or suggestions in the good direction are welcome - I really want to start with the real work on that app
Cheers!
Jeroen De Dauw
---
Forums ; Blog ; Wiki
---
70 72 6F 67 72 61 6D 6D 69 6E 67 20 34 20 6C 69 66 65!
|
|
|
|
|
This article (demo) here at The Code Project probability has every example you are looking for. It's a really nice diagramming application in the works.
WPF Diagram Designer - Part 2[^]
|
|
|
|
|
jeroen de dauw wrote: how to effectively get the coordinates
When handling mouse events, you can use the GetPosition() method
on the MouseEventArgs/MouseButtonEventArgs object to get the
coordinates relative to an element.
You can also use System.Windows.Input.Mouse.GetPosition() to
get the current coordinates relative to an element.
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hey guys,
I did search for such a method, and didn't find one. Guess why...
Somehow I managed to click the KeyDown event instead of the MouseDown one
Anyway, thanks for the helping
Cheers!
Jeroen De Dauw
---
Forums ; Blog ; Wiki
---
70 72 6F 67 72 61 6D 6D 69 6E 67 20 34 20 6C 69 66 65!
|
|
|
|
|
I'm probably doing something stupid wrong here, but my event handler for the MouseDown event is not getting called when I click on my canvas. Anyone an idea what I'm messing up?
Curious if I'm failing at C# or at WPF here
Cheers!
Jeroen De Dauw
---
Forums ; Blog ; Wiki
---
70 72 6F 67 72 61 6D 6D 69 6E 67 20 34 20 6C 69 66 65!
|
|
|
|
|
|
Hi all,
I am making use of a DataForm to display my data. I have made use of the DataForm edit template to customize the layout of the form. Data is returned and is being displayed within the DataForm. The problem is that, as soon as I start navigating (2 navigation clicks) with the DataFrom, only the ComboBox 'looses' it's binding on the SelectedItem (although it's selected item was data bound and then it just goes blank ).
The back end code consists of a generic list List<string> and a string variable that has the value of each data item that is returned.
..
public List<string> Category { get; set; }
public string CategoryName { get; set; }
..
The XAML code:
...
<dataFormToolkit:DataField DescriptionViewerPosition="Auto" LabelPosition="Left" LabelVisibility="Visible" Label="Category">
<ComboBox ItemsSource="{Binding Category}" SelectedItem="{Binding CategoryName, Mode=TwoWay}" />
</dataFormToolkit:DataField>
...
Any reason why this is happening and how I can fix it?
Many thanks in advance.
Kind regards
The only programmers that are better C# programmers, are those who look like this -> |
Programm3r
My Blog: ^_^
modified on Wednesday, December 30, 2009 8:36 AM
|
|
|
|
|
Hey. This problem has been bugging me a lot lately - Something really odd is happening in the framework. What's happening is the data field control is modifying the bindings on the control and re-setting them. Setting the SelectedItem works fine, but when it comes to re-set the ItemsSource property the binding for the *SelectedItem* property *vanishes* without a trace.
The only workaround I have at the moment is to make the ItemsSource binding TwoWay, and ensuring that the property it's bound to is read-only. This stops the code from modifying the ItemsSource binding.
However, I'm now finding that the bindings are disappearing under other circumstances as well (it looks like it's happening occasionally when there is more than 1 combo box in the form) - I haven't solved that one yet.
Cheers,
Mike
|
|
|
|
|
Is there a single method in WPF that can handle all types of input at once, like WndProc in Windows Forms? Or do I have to capture and forward each event separately?
|
|
|
|
|
Hmm... I never knew there was such a thing for WinForms.
Good Question.
|
|
|
|
|
Badda Bam![^]
Don't be overcome by evil, but overcome evil with good
|
|
|
|
|
Thanks for your reply.
Of course, it should do the job. Anyway, it seems to be a pretty strange work-around. You're provided with dozens of overridable methods for handling input, but you have to use native hooks...
|
|
|
|
|
Hi friend
can any body tell me why ScrollViewer Clip its content. is set CliptoBound property to false.
any body new any solution for it.
WANTED wasim khan(Killed 50 Innocent Buggs, Distroyed 200 Exception, make 5 Project Hostage) any Compnay Hire him will pay 30,000. Best place where u can get him is Sorcim Technologies Murre Road RWP
|
|
|
|
|
wasimsharp wrote: why ScrollViewer Clip its content
That's the way the ScrollViewer is designed to work.
The ScrollViewer uses a fixed-size viewport to view a
portion of the scrollable content.
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hi guys.
I'm looking for a sample of ListView that contains some ListViewItems in XAML code.
I have been searching the web but I couldn't find any useful sample !
Could you guide me ?
Thanks.
|
|
|
|
|
As I stated in the other thread:
try google:
'ListView ListViewItem XAML .NET site:msdn.com'
|
|
|
|
|
Thanks TheArchitectmc∞ , I've done it former, but I couldn't find anything special.
|
|
|
|
|
how can login authentication (use windows media service 2008) in silverlight 3
|
|
|
|
|
Are you talking about IIS media services?
Link here [^].
There's nothing left in my right brain and nothing right in my left brain. |
|
|
|
|
|
Here is my scenario:
Data Layer : running as an simple web service as required by Silverlight
Entities are generated from the database tables
An extended class is defined with the following additions:
public partial class CustomerMaster
{
public override string ToString( )
{
return this.CustomerName;
}
}
public partial class CustomerLocation
{
public override string ToString( )
{
return this._LocationID;
}
}
CustomerMaster and CustomerLocation are two entities derived from the database.
Silverlight side
When I get my data I bind a list box to the result of my async query.
I get the list of customers no problem.
But listbox calls ToString() on my objects and I'm getting the default behaviour (namespace) not my overridden code!!!???
Anyone know a reason why this would happen?
|
|
|
|
|
Methods are not part of the DataContract so they won't be available when you create the proxy for the client.
There's nothing left in my right brain and nothing right in my left brain. |
|
|
|
|
|
yeh...found I had to specify the field in the data to display within the properties.
|
|
|
|
|
how can i draw grid in 3D environment using wpf (suppose i want to draw i room using line)
|
|
|
|