|
Whenever I try to run the WPF application I am getting the following error:
Cannot create instance of 'Window1' defined in assembly 'C1WPFGrid, Version=1.0.0.0,
Culture=neutral, PublicKeyToken=null'. Exception has been thrown by the target of an
invocation. Error in markup file 'Window1.xaml' Line 1 Position 9.
Am I leaving out any declarations ? Please advise !
Best Wishes ....... ARIJIT
|
|
|
|
|
This normally means that there's a bit of a binding problem going on here. Take a look in the Output window to see if anything's causing a problem - also, set a breakpoint on the InitializeComponent method.
|
|
|
|
|
Arijit Manna wrote: Error in markup file 'Window1.xaml' Line 1 Position 9.
I'm curious....what does line 1 of 'Window1.xaml' look like?
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
The delrations in XAML are like theis :
<Window x:Class="Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="CIWPFGrid" Height="346" Width="628" xmlns:c1grid="http://schemas.componentone.com/wpf/C1DataGrid" WindowState="Maximized">
Best Wishes ....... ARIJIT
|
|
|
|
|
In addition to Pete's suggestions, I would try removing elements from the
window and adding them in one at a time until it breaks. XAML makes that
an easy process.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hello,
I am trying to convert some vector based objects into a raster bitmap.
I manage to do that, but the result is blurry, meaning, edges are blurry instead of jagged.
I assume an anti-aliasing algorithm is applied, but I do not want to be applied...
here is my simplified code in which I draw a circle and make a raster out of it to an Image Control:
DrawingVisual drawingVisual = new DrawingVisual();
DrawingContext drawingContext = drawingVisual.RenderOpen();
drawingContext.DrawEllipse(Brushes.Red, new Pen(Brushes.Red, 1), new Point(50, 50), 50, 50);
drawingContext.Close();
RenderTargetBitmap bmp = new RenderTargetBitmap(180, 180, 96, 96, PixelFormats.Pbgra32);
bmp.Render(drawingVisual);
_image.Source = bmp;
Here is an image to make it clearer.
What I want is the jagged edged circle...
Sample Image[^]
Does anyone have any idea why this happens???
Thanks!
|
|
|
|
|
Hi guys.
I wanna use a WinApp control in WPF ( Like Vista Clock[^] )
But I don't know how I can do it.
Any ideas will be appreciating .
|
|
|
|
|
use
<windowsformshost>
Place that control in this place..
</windowsformshost>
try this...
modified on Thursday, December 11, 2008 6:42 AM
|
|
|
|
|
|
Hi.
How can we get position of Mouse Cursor on Desktop in WPF and C# ?
Thank you.
|
|
|
|
|
Listen to the MouseMove event.
|
|
|
|
|
You're right, but when the Mouse Cursor is away of our window , we can't get the position of it .
I've wanted that.
|
|
|
|
|
How about the Mouse class[^]?
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
http://msdn.microsoft.com/en-us/library/ms648402(VS.85).aspx
http://www.pinvoke.net/default.aspx/user32/GetCaretPos.html
Don't be overcome by evil, but overcome evil with good
|
|
|
|
|
|
Hello.
How can we change the Window Location in WPF with C# code ?
Thank you.
|
|
|
|
|
|
Mohammad Dayyan wrote: How can we change the Window Location in WPF with C# code ?
Set its Left and Top properties.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hello,
So far i have posted my little problem on several forums, some help but resolution to my problem. On with the question: I have a program, i want the user to be able to print any size from the print dialog form under preferences when they choose to select 8x11 etc and it will print the picture that you see on the image viewer. So far my printing is not working, it only prints the size of the imageviewer which is small but i want the user to select whatever size they want and whatever or how many copies they want it. I have the code below including the XAML, please helpa
Thank you in advance:
code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Windows.Forms;
namespace ImageViewer
{
/// <summary>
/// Interaction logic for Window1.xaml
/// </summary>
public partial class Window1 : Window
{
public Window1()
{
InitializeComponent();
}
private void BrowseButton_Click(object sender, RoutedEventArgs e)
{
try
{
OpenFileDialog dlg = new OpenFileDialog();
dlg.InitialDirectory = "c:\\";
dlg.Filter = "Image files (*.jpg)|*.jpg|(*.bmp)|*.bmp|All Files (*.*)|*.*";
dlg.RestoreDirectory = true;
if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
string selectedFileName = dlg.FileName;
FileNameLabel.Content = selectedFileName;
BitmapImage bitmap = new BitmapImage();
bitmap.BeginInit();
bitmap.UriSource = new Uri(selectedFileName);
bitmap.EndInit();
ImageViewer1.Source = new BitmapImage(new Uri(selectedFileName, UriKind.Absolute));
}
}
catch (Exception)
{
}
}
private void btnclose_Click(object sender, RoutedEventArgs e)
{
this.Close();
}
System.Windows.Controls.PrintDialog dlg = new System.Windows.Controls.PrintDialog();
private void btnprint_Click(object sender, RoutedEventArgs e)
{
if ((bool)dlg.ShowDialog().GetValueOrDefault())
{
Size pageSize = new Size();
// sizing of the element.
ImageViewer1.Measure(pageSize);
dlg.PrintVisual(ImageViewer1, Title);
}
}
}
}
XAML:
<Window x:Class="ImageViewer.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Window1" Height="351" Width="486">
<Grid Height="310" Width="438">
<Button Margin="0,12,13,0" Name="BrowseButton" Click="BrowseButton_Click" HorizontalAlignment="Right" Width="102" Height="43" VerticalAlignment="Top">Browse</Button>
<Label Margin="86,0,13,19" Height="25" Name="FileNameLabel" VerticalAlignment="Bottom" />
<Label Margin="14.5,0,0,19" Height="23" Name="Label1" HorizontalAlignment="Left" VerticalAlignment="Bottom" Width="70.15">Current File:</Label>
<Image Margin="14.5,12,130,63" Name="ImageViewer1" Stretch="Fill" />
<Button HorizontalAlignment="Right" Margin="0,149,13,118" Name="btnprint" Width="102" Click="btnprint_Click">Print</Button>
<Button Height="41" HorizontalAlignment="Right" Margin="0,0,13,63" Name="btnclose" VerticalAlignment="Bottom" Width="102" Click="btnclose_Click">Close</Button>
<RadioButton HorizontalAlignment="Right" Margin="0,86,-5,0" Name="rdb4by6" Width="120" Height="15" VerticalAlignment="Top">4x6</RadioButton>
<RadioButton Height="16" HorizontalAlignment="Right" Margin="0,105,-5,0" Name="rdb5b7" VerticalAlignment="Top" Width="120">5x7</RadioButton>
<RadioButton Height="16" HorizontalAlignment="Right" Margin="0,126,-5,0" Name="rdb8x11" VerticalAlignment="Top" Width="120">8x11</RadioButton>
<Label Height="28" HorizontalAlignment="Right" Margin="0,54,-5,0" Name="label2" VerticalAlignment="Top" Width="120">Select Print Size</Label>
</Grid>
</Window>
|
|
|
|
|
hellow friends this is
<big>NAVINKUMAR:rolleyes: </big> from Coimbatore i am doing my final year project in using SILVERLIGHT i am new to this technology so some one help me to understand SILVERLIGHT to do my project
HELP ME ! !
|
|
|
|
|
|
I am almost thinking about WPF but from what I have seen so far (very shallow only) it seems to be all about binding. I hate binding, one of the first utilities I wrote was a BindForm which takes a datarow and a form and loops through the controls and containers on a form looking for control names matching the columns of the datarow and binding them. That was years ago and have hardly looked at binding since.
So all my dialog forms take the same steps
populate the combos
Get the datarow
call BondForm(this, drData)
Can this be done in WPF?
Is it reasonable to do this or is it defeating the purpose of WPF?
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
While you could do this, you really are defeating the purpose of binding in WPF here. It's a whole different beast to what you got with WinForms and ASP.NET - it's far more powerful. Here[^], I demonstrate binding in ASP.NET, versus WPF to demonstrate binding at a very basic level. If you follow my blog links, I talk about binding in more detail.
|
|
|
|
|
Pete O'Hanlon wrote: you really are defeating the purpose of binding in WPF
Yeah, that's what I thought, I must admit I'm all about the data, and battleshit gray screens are just fine by me. Ah well, every thing changes I guess.
If I pursue this, at least there seems to be plenty of quality resource here, thanks
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
To be fair though, battleshit gray doesn't cut it any more ... at least from a users point of view.
|
|
|
|