|
What about subscribing to the event(s) on the ElementHost object
instead?
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
unfortunately the ElementHost appears to be very rudimentary but thanks for the thought.
|
|
|
|
|
Hello
I am getting the following error.
"An error occurred while processing this request."
My code is as bellow:
private void btnShow_Click(object sender, RoutedEventArgs e)
{
Uri ur = new Uri(System.Windows.Browser.HtmlPage.Document.DocumentUri,"WebDataService1.svc");
WapCosEntities context = new WapCosEntities(ur);
var query = from u in context.UserMgmt
orderby u.ECode
select u;
var dsQuery = (DataServiceQuery<UserMgmt> )query;
dsQuery.BeginExecute(result => lstCustomers.ItemsSource = dsQuery.EndExecute(result), null);
int i = lstEmpCode.Items.Count;
}
Help me please.
|
|
|
|
|
rag_Singh wrote: Uri ur = new Uri(System.Windows.Browser.HtmlPage.Document.DocumentUri,"WebDataService1.svc");
Use the following & check if it resolves your problem:
ur = new Uri(App.Current.Host.Source, "../WebDataService1.svc");
Regards,
- Kunal Chowdhury ( My Blog)
|
|
|
|
|
I want to know how to do something like this in WPF.
Graphics gfx = MainForm.CreateGraphics();
gfx.DrawRectangle(new SolidBrush(Color.Blue), 0, 0, 100, 100);
I don't want to deal with WPF controls, windows, and XAML at this point. I just want hardware accelerated rendering of simple graphics. Particularly images and rectangles.
|
|
|
|
|
Override the OnRender method of the window. The DrawingContext it gives you should do what you need.
|
|
|
|
|
Like I said. I want to draw with WPF, but I don't want to deal with WPF windows/controls, and XAML.
|
|
|
|
|
Ah, ok, so you want to embed a WPF drawing surface inside WinForms. Well, you'll need at least one WPF control, if you want to use WPF drawing methods...
Here's a decent-looking google hit: http://www.switchonthecode.com/tutorials/wpf-tutorial-using-wpf-in-winforms[^]
You should be able to skip the XAML part of that tutorial, if you just want a drawing surface... Inherit an ElementHost, put it on your form, override the OnRender method, etc etc.
|
|
|
|
|
CaptainSeeSharp wrote: Graphics gfx = MainForm.CreateGraphics();
This is always bad code, unless you're drawing a rubber band.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
The one which comes with PaintEventArgs is the correct way, is it?
50-50-90 rule: Anytime I have a 50-50 chance of getting something right, there's a 90% probability I'll get it wrong...!!
|
|
|
|
|
Yes, handling the paint event is correct. What he is doing will work, so long as no other window ever obscures his window, or he doesn't ever minimise and reshow it. Otherwise, what he drew, will disappear.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
But if he has placed the same code in Paint event, I will be one stupid working way.
50-50-90 rule: Anytime I have a 50-50 chance of getting something right, there's a 90% probability I'll get it wrong...!!
|
|
|
|
|
*grin* yes, that would be funny.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
If you're using Deep Zoom, only the parts of the image
being viewed get downloaded (in tiles), so no matter
how large the image is it should download in a reasonable
amount of time.
I regularly work with 1GB+ images.
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hi All,
'IEditableCollectionView' is A good concept to deals with data adding and removing new items, as well as editing items in a transactional way to bind WPF Data Grid.
Can you help me..How to implement it for WPF Data Grid ?
My Requirement : I have multiple WPF Data Grid's with single data source ( DataSet Or DataTable). I want add new empty row to all datagrid's at single click (i did it partially).
** All Datagrid columns are single click editable -- done.
But whenever user click on 'add' button an empty row is added to all three grid's (above said). i want to update data on button save click event.
My problem is.... i am unable to get User entered data from CollectionView...
if any body have good knowledge on 'IEditableCollectionView' concept...please explain me How to edit/Update and Delete rows from collection view...
if you provide samples or Url's really gr8 helpful me..
Thanks in advance.
Eswara G
|
|
|
|
|
|
noufal2009 wrote: When I am trying to retrieve only first column value of excel sheet using the below code,I am getting garbage values.
You cannot read an Excel file with StreamReader()[^].
|
|
|
|
|
Hi,
My project contains a class, Symbol, which derives from UserControl and adds some custom dps etc... In code, Symbol also implements a Popup containing a TabControl along with the relevant click handlers to make this popup appear. Any objects which derive from Symbol have this popup which works fine.
I now need to be able to add new custom TabItems to the TabControl in the derived classes. I can do this in my code behind file but was wondering what the correct syntax is in WPF to add a TabItem to a parent's TabControl.
Can anyone help?
Cheers
Rich
|
|
|
|
|
Maybe
myTabControl.Items.Add(newTabItem);
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Ah sorry, thanks for your response, but I wasn't clear in my OP.
I actually meant what would be the syntax for doing this in XAML? My XAML class derives from a class with the TabControl defined, how can I access it to add a new TabItem within my derived XAML or is this not possible?
TIA
Rich
|
|
|
|
|
Maybe the ContentPropertyAttribute[^] is what you need.
There's an example using a List property here[^].
I think you could define a collection dependency property (or property
that implements change notifications) and use that as your control's
[ContentProperty]. That will allow you to specify multiple items in XAML.
Bind the ItemsSource of the embedded TabControl to that property.
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hi all,
When I was working on WCF(3.5) i got a doubt. Here it is
WCF introduced in frame work 3.0 version. At the time of release there is no Visual studi 2008. Then hw WCF application developed,i.e, to develop wcf application with 3.0 frame work what is the tool.
PLease correct me if the question it self is wrong.
Thanks,
Srinivas Mateti
|
|
|
|
|
sris 426 wrote: At the time of release there is no Visual studi 2008. Then hw WCF application developed,i.e, to develop wcf application with 3.0 frame work what is the tool.
There were some add-ins for WCF, WF and WPF development (I don't think they're accessible anymore). For WCF, you didn't really need to use the add-in though. Just having .NET 3.0 installed was enough.
Kevin
|
|
|
|
|
Hi,
I'm in the process of refactoring some code I've inherited and as a part of this I need to re-create a binding which was previously in my WPF in code. The WPF snippet is:
<pre><TabItem Header="Notes">
<my:HelpEditor PlantId="{Binding Path=Id, RelativeSource={RelativeSource FindAncestor, AncestorLevel=1, AncestorType={x:Type my:Symbol}}}">
</TabItem></pre>
But I am now producing these TabItems in code so need to reproduce this binding in my code-behind file. In this case HelpEditor is a custom UserControl with a PlantId dependency property and Symbol is a custom object with a Id dependency property. HelpEditor needs to be bound to the Id in Symbol and so this WPF binding code works fine.
Here is the code I am trying to use in my code-behind file:
<pre>TabItem ti = new TabItem();
ti.Header = "Notes";
helpEditor = new ScadaAlarmViewer.HelpEditor();
Binding idBinding = new Binding("Id");
idBinding.RelativeSource = new RelativeSource(RelativeSourceMode.FindAncestor, typeof(MyStuff.Symbol), 1);
helpEditor.SetBinding(MyStuff.HelpEditor.PlantIdProperty, idBinding);
ti.Content = helpEditor;</pre>
But this doesn't work, I get:
<pre>System.Windows.Data Error: 4 : Cannot find source for binding with reference 'RelativeSource FindAncestor, AncestorType='MyStuff.Symbol', AncestorLevel='1''. BindingExpression:Path=Id; DataItem=null; target element is 'HelpEditor' (Name=''); target property is 'PlantId' (type 'String')</pre>
In the output window. If it's relevant, these TabItems are contained withint a Popup.
Can anyone help?
Rich
|
|
|
|
|
I think the problem comes from the fact that you are setting the binding before you have put the helpEditor into the visual tree. I think you will need to rearrange into something like:
TabControl tc = ;
TabItem ti = new TabItem();
ti.Header = "Notes";
helpEditor = new ScadaAlarmViewer.HelpEditor();
Binding idBinding = new Binding("Id");
idBinding.RelativeSource = new RelativeSource(RelativeSourceMode.FindAncestor, typeof(MyStuff.Symbol), 1);
ti.Content = helpEditor;
tc.Items.Add(ti);
helpEditor.SetBinding(MyStuff.HelpEditor.PlantIdProperty, idBinding);
|
|
|
|