|
I don't think he liked our answers mate.
"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
|
|
|
|
|
How to handle WPF datagrid row double click event? I tried with PreviewMouseClick. But it is getting throwed when clicked on header also.
Private Sub dbGrid_PreviewMouseDoubleClick(ByVal sender As Object, ByVal e As System.Windows.Input.MouseButtonEventArgs) Handles dbGrid.PreviewMouseDoubleClick
If Not dbGrid.SelectedItem Is Nothing Then
MsgBox(DirectCast(DirectCast(DirectCast(dbGrid.SelectedItem, System.Object), System.Data.DataRowView).Row, System.Data.DataRow).ItemArray(0).ToString)
End If
e.Handled = True
End Sub
How to handle it only for datagrid row?
|
|
|
|
|
After I've hacked together my first WPF app today, I'd like to embark on a slightly more formal approach to continuing to learn WPF. What do you guys recommend?
|
|
|
|
|
I'd recommend that you knock something up using MVVM. It's a great pattern, and you'll find it helps you a lot later on.
"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
|
|
|
|
|
Read all the articles here on The Code Project by Josh Smith & Sacha Barber, particularly their introduction sets. Also take a look at the books they recommend as they are likely to be useful.
|
|
|
|
|
I'd recommend getting Pro WPF in C# 2008 by Matthew MacDonald It's well organized, takes you step-by-step through WPF and covers most of it. I still refer to it when I'm coding WPF.
|
|
|
|
|
Colleagues,
Familiarizing myself with DataGrid (and with C# in general). My DataGrid is declared like this:
<my:DataGrid AutoGenerateColumns="True" Margin="74,32,68,103" Name="dataGrid1" xmlns:my="http://schemas.microsoft.com/wpf/2008/toolkit" />
I’m setting the ItemSource property equal to a list of strings.
public Window1()
{
InitializeComponent();
List<string> lstGridData = new List<string>();
for (int i = 0; i < 8; ++i) lstGridData.Add("str");
dataGrid1.ItemsSource = lstGridData;
}
I’m expecting that grid would display one column and each line would show “str”. Instead, the grid displays one column titled “Length” and each line displays “3”.
What am I missing?
Cheers,
- Nick
|
|
|
|
|
The AutoGenerateColumns mechanism binds to any bindable properties
it finds in the objects in the List.
For a string, that's String.Length.
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
How can I make a "bindable string"? Is there a framework object with a bindable string property which is commonly used for this purpose? May be, one option is to make a wrapper object with a bindable string property (call it, say, BindableString).
Is there a simple/quick solution to "populate DataGrid with primitive values" problem?
Tried with manually defined columns (AutoGenerateColumns=False). Didn't work either. Looking for a good DataGrid tutorial...
Cheers,
- Nick
modified on Monday, October 19, 2009 2:26 AM
|
|
|
|
|
Nick Alexeev wrote: Is there a simple/quick solution to "populate DataGrid with primitive values" problem?
Manually bind to the object itself...
<my:DataGrid AutoGenerateColumns="False" Name="dataGrid1" xmlns:my="http://schemas.microsoft.com/wpf/2008/toolkit" >
<my:DataGrid.Columns >
<my:DataGridTextColumn Header="String" Binding="{Binding Path=.}" />
</my:DataGrid.Columns>
</my:DataGrid>
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hi
I have built a web service pull data off from one application, which in turn links to another application's web service. However, when I look at one of the data types, which happens to be a list object, Visual Studio shows it as an array.
Can someone please advise me how I can use the meta data to correct this to a list object, or if there is another way to correct this?
Thanks
|
|
|
|
|
It returns an array because a web service has nothing to do with Microsoft technologies - they are intended for other platforms as well. This means that you can't return a List return because it's a generic, which isn't allowed in web services. If you really need to use the return type in a generic list, you simply need to add the items in using the following logic:
List<MyObject> list = new List<MyObject>();
list.AddRange(myWebService.WebServiceMethod());
"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
|
|
|
|
|
The proxy generator can be configured to return a Collection . In fact it can even be configured to return a custom collection class that is shared between the client proxy and server code.
/ravi
|
|
|
|
|
Hi
Ok, how do you configure the proxy to return a List?
|
|
|
|
|
Use the /ct [^] flag.
/ravi
|
|
|
|
|
...or right-click the service reference in the Solution
Explorer, choose "Configure Service Reference", and
set the collection type.
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Well, I tried your solution, but it made no difference. Is there another way to solve this? Is some way in the binding to force the datatype to be a particular type?
Thanks
|
|
|
|
|
Make sure all the service references involved are configured the
way you want them and updated (right click service referenc(es) and
choose "Update Service Reference").
If the automatic code generation tool isn't giving you what you
need then you can always hand-code the service interface stuff.
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
There's even some who would never use a tool to generate
the proxy code for them
(I am not one of them)
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
I just had a surprise from WPF in that the drawing functions are anti-aliasing (or something similar) my drawing.
Im not doing naything fancy :
....
RenderTargetBitmap renderBitmap = new RenderTargetBitmap (
PixelWidth,
PixelHeight,
DpiX,
DpiY,
PixelFormats.Pbgra32 );
foreach ( DrawingVisual aVisual in visuals )
{
//blah blah, get dc for each visual in my list, draw geomtry to visual
...
renderBitmap.Render ( aVisual );
...
}
Image img = new Image ( );
img.Source = renderBitmap;
///blah blah encode and save stream to file
all the geometries are simple pens of single color, but the final image has been antialiased, edge colors 'smoothed'.
As this is is an imaging app where every pixel value must be specific, I cant tolerate any kind of 'smart' smoothing.
What am I doing wrong wrong ? How can I guarantee that ONLY those colours that I specify will be displayed ? There must be someway to turn off this ant-aliasing.
thanks for your help, any suggestions or alternative would be appreciated.
|
|
|
|
|
Have you tried setting the VisualEdgeMode property of your DrawingVisuals
to Aliased (or maybe setting RenderOptions.EdgeMode="Aliased" on your RenderTargetBitmap,
something like RenderOptions.SetEdgeMode(renderBitmap, EdgeMode.Aliased); ?
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Thanks
I tried that on pretty well everything, the RenderTargetBitmap, the DrawingVisuals, and the PathGeometries (and even their pen and brush and Transform ) but still no luck.
That option didnt seem to make any noticable difference.
Any other suggestions ?
|
|
|
|
|
Hi,
I am trying to develop a desktop application in which I need to save some data locally. There will be images and information related to images in xml. There can be 100’s of images and multiple xml files.
1. How can I save all files (images + xml file) into one DAT file (so to speak)?
2. Could it be possible to save files in different folders inside that DAT file? If yes, how?
3. If I decide to use Access dbf file instead of xml, can it be saved as part of dbf file?
Please advice. Thanks
Pankaj
Follow your goals, Means will follow you ---Gandhi---
|
|
|
|
|
There's nothing in your post related to WPF/WCF/WF.
You can store any data you'd like to in a file.
You'll probably need to come up with a file format
that has enough information to extract individual items,
perhaps some kind of "directory".
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
For some reason I have to use the cumbersome Pack URI format to access an image file in my assembly. When I use a relative URI I get a System.InvalidOperationException on the following statement: Uri uri = new Uri(ResourcePath, UriKind.Relative); . It works fine when I use the following statement: Uri uri = new Uri("pack://application:,,,/" + ResourcePath); . Here ResourcePath is set to "Resource/Screenshot.png" and "Resource" is directly under my project in the Solution Explorer. Of course the Build Action of the .png file is set to "Resource" or even the Pack URI wouldn't work, which it does. What could be causing this kind of problem?
|
|
|
|