I am using DrawingContext to draw text, and then i print visual throu PrintDialog. I want to convert input from milimeters. I do not know formula and on google i only found a few pieces, but i realy want to be printer independet.
I found on a Some page
1 mm = 3.779528 px
Is this printer independet. I am writing an application that will print on normal A4 printer or on 60mm x Reciept type printers. My app is already printing, but some values i want to be in pixel and some in mm.
Edit: Upon remote testing i noticed that no matter if Printer is 600DPI or 300dpi. I can simply ignore these values
I Know WPF is DPI indipented when putting it on screen.
Does that extend to Printing? I am using Drawing Context and all values are pixel based. My Printer has resolution 600dpi. But other printer that is currently not awaible is STAR SP 200 Series. It is a 300DPI Matrix type printer.
When you use Visual Studio to write your project (no matter what type of app you are writing), it does a lot of background build work. The .g.cs and .g.i.cs files are auto-generated from XAML files when the build process runs; the .g.i.cs is the part that ties into the Intellisense builder.
As far as removing the unused usings, you'd have to edit the source template. On my machine, running Visual Studio 2012, they are located under C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\ItemTemplates\CSharp\WPF\1033. Obviously, you'd have to pick your appropriate VS install location, but this should give you a head start.
I was brought up to respect my elders. I don't respect many people nowadays.
But that is a auto-generated file, if we manually remove the usings then it will again recreate when we rebuild the project. Therefore I need a permanent fix, something like as suggested by Pete to edit the template but unfortunately I'm unable to find that template.
Some of them are required for starting the app, intellisense, assembly identification etc.
Take a look at the App.g.cs (for a desktop wpf app). It loads the BAML (compiled XAML, embedded as a resource in the assembly) to the XAML parser. Without it probably your WPF application will not run. They just contain few lines of code so not a thing of worry as they aren't huge memory/cycle eating hogs!
Beauty cannot be defined by abscissas and ordinates; neither are circles and ellipses created by their geometrical formulas.
Im using MVVM. I have a form and a grid view below the form. Once I save data in GridView, it goes to database and show in GridView. I want to load data to the controls when select a particular row in GridView.
I am trying to create a reasonably complex datagrid.
At the core, there are sting pairs where the first string is the key and the second is the value.
I make 2 passes through the base array. Don't try to understand the base array, just accept that 2 strings, key and value, are extracted.
On the first pass, the datagrid has columns dynamically created. The column names works as expected. I believe the binding is not correct.
Once all know possible columns are known, the second pass extracts the key/value pairs from the original table and composes a dictionary called "person".
The original table is a 2 dimensional table, first an array of key/values of dynamic length then a dynamic number of such arrays.
Each dictionary is added to a List called "persons"
If a particular key is not found in the base table, the value "_" is assigned.
Finally the datagrid.itemsource is assigned the list "persons".
When the datagrid is displayed, the column names are correct.
The number of columns is correct.
The number of rows is correct but blank.
The debugger output window shows a flurry of error messages such as:
System.Windows.Data Error: BindingExpression path error: 'mv' property not found on 'System.Dynamic.ExpandoObject' 'System.Dynamic.ExpandoObject' (HashCode=60469192). BindingExpression: Path='mv' DataItem='System.Dynamic.ExpandoObject' (HashCode=60469192); target element is 'System.Windows.Controls.TextBlock' (Name=''); target property is 'Text' (type 'System.String')...
Note that "mv" is one of the column names.
When I display the "persons" list using the debugger dynamicview for "persons" it does show the column name "mv" with the correct value.
I think I found a solution to this. I just selected the first namespace that had the same name as my project. My project name is ParametricModeler. So I typed:
and selected the option ParametricModeler(ParametricModeler). So that I have
That let me add the user control I made to the MainWindow.
I was working from a youtube video: [^]
But this is not the way xmlns namespace was selected in the example video. The name of the UserControl was added to the namespace options list after the project was rebuilt. But I could not get that option and I tried several times with different projects. He was using a different version of Visual Studio would that mater? Did I do good? I am using VS 2012.
Also how do you add a property to a user control if you are coding in Visual Basic?
The reason the UserControl can't access the gradient brush is because it's a Window resource. If it was a userControl resource, <UserControl.Resources>, then you wouldn't be getting the error. Alternatively you could place the gradient brush in a ResourceDictionary.
"As beings of finite lifespan, our contributions to the sum of human knowledge is one of the greatest endeavors we can undertake and one of the defining characteristics of humanity itself"
I have a WPF project where I have a main grid and inside that I have some basic 3D elements for basic 3D modeling of points in time(like a 3D grapher). I am using a seperate library for the 3D stuff. I added basic tools like a calculator and a timer control and other controls. These controls consist of a grid and inside that grid is a rectangle control and some textboxes and buttons. I do not know how to make the grids be dragable like a regular window. Is there a simple method for this?
I am using Visual Studio Express Edition 2012. I program in Visual Basic. Thanks for your help.
Thanks for the reply sorawit amorn. Sorry about the delay.
So I made a new project to focus on just this dragging issue. I am not great with C# but I get most of what you have there. I declared a canvas and a grid inside that canvas in the xaml code of the main window. In the behind VB code I created a loaded event handler with the initial grid positions.
PrivateSub MainWindow_Loaded(sender AsObject, e As RoutedEventArgs) HandlesMe.Loaded
EndSubPrivateSub MainWindow_MouseLeftButtonDown(sender AsObject, e As MouseButtonEventArgs) HandlesMe.MouseLeftButtonDown
'What do I need to do next?
I have no idea how to write in code what I need to do next. I need a conditional statement for when the mouse is over the grid control. Then I need to get the position of the cursor and somehow update the position of the control simultaneously. How do I do that? Thanks again.