|
How I get Application_Exit Eventhandler in javascript code....
I mean when Application_Exit Eventhandler fires how I notify in
javascript
modified 9-Jan-13 15:35pm.
|
|
|
|
|
Hi Kashif,
You can call any JavaScript function on your page like so:
void Application_Exit(object sender, EventArgs e)
{
HtmlPage.Window.Invoke("OnSilverlightExit", new[] { "some data" });
}
Here we see that the JavaScript function OnSilverlightExit is called and is passed a string parameter "some data".
The JavaScript function can then do whatever you need.
function OnSilverlightExit(identifier) {
}
There's some more information here[^] about communicating between a page in JavaScript with a Silverlight application.
Cheers,
Daniel
|
|
|
|
|
Hi everyone,
Problem is solved.
I find out the problem it is port number issue.
Thanks
I have been working on silverlight, it works fine for a while but becomes idle especially after one day or turn off my laptop.
By the way it correctly displays what I wished to view, it is a table from a .mdf database (AdventureWorksLT.mdf). Please help me it is urgent.
Thank youmodified on Monday, February 22, 2010 3:40 AM
|
|
|
|
|
Hi All,
I'm just making a Gallery viewer for my new site and am seeing something odd.
The Gallery page presents the user with a few galleries they can view, when they click a view button the gallery is opened in a ChildWindow . Everything works as expected until I close that window and click on another view button, the silverlight application bombs and I'm left with a blank browser. It might do it after clicking 4 galleries or just 1.
The app does better running under the development server rather than IIS (5.1). I'm listening for any UnhandledException but not seeing any. With no exception being throw this is pretty difficult to diagnose. Any ideas?
Thanks,
|
|
|
|
|
Hello,
I am having some issues with the display of the DataGridColumnHeadersPresenter in my custom DataGrid template.
Example Screenshots
I have taken the original ControlTemplate for DataGrid and altered the area related to the DataGridColumnHeadersPresenter and the select all Button. What I am experiencing when I load the application (Figure A) is the area taken up by the DataGridColumnHeadersPresenter is longer than it should be (on the right side) by 2 pixels (or whatever the margin is set to). It also appears clipped as it does not show the right side border or the corner radii.
When I adjust the size of the window at runtime using the Window 'resizing handles' (Figure B) the appearance changes and the DataGridColumnHeadersPresenter appears as I expect it to. However when I resize it small enough so that the DataGrid's horizontal scroll becomes active (Figure C) it again appears clipped, this time being a few pixels shorter than the expected length.
Custom Row, RowHeader, Cell and ColumnHeader styles are also in use, but removing them does not change this problem.
Original
<!--Left Column Header Corner -->
<Button Command="{x:Static dg:DataGrid.SelectAllCommand}"
Width="{Binding RelativeSource={RelativeSource AncestorType={x:Type dg:DataGrid}}, Path=CellsPanelHorizontalOffset}"
Template="{StaticResource SelectAllButtonTemplate}"
Focusable="false"
Visibility="{Binding RelativeSource={RelativeSource AncestorType={x:Type dg:DataGrid}},
Path=HeadersVisibility,
Converter={x:Static dg:DataGrid.HeadersVisibilityConverter},
ConverterParameter={x:Static dg:DataGridHeadersVisibility.All}}" />
<!--Column Headers-->
<dgp:DataGridColumnHeadersPresenter Grid.Column="1"
Name="PART_ColumnHeadersPresenter"
Visibility="{Binding RelativeSource={RelativeSource AncestorType={x:Type dg:DataGrid}},
Path=HeadersVisibility,
Converter={x:Static dg:DataGrid.HeadersVisibilityConverter},
ConverterParameter={x:Static dg:DataGridHeadersVisibility.Column}}"/>
My Changes
<tkp:DataGridColumnHeadersPresenter x:Name="PART_ColumnHeadersPresenter"
Grid.Column="1">
<tkp:DataGridColumnHeadersPresenter.Template>
<ControlTemplate TargetType="{x:Type tkp:DataGridColumnHeadersPresenter}">
<Border Background="{Binding Path=AlternatingRowBackground,
RelativeSource={RelativeSource AncestorType={x:Type tk:DataGrid}}}"
BorderBrush="#FFB4B4B4"
BorderThickness="0,1,1,1"
CornerRadius="0,2,2,0"
Margin="0,0,2,1">
<ItemsPresenter/>
</Border>
</ControlTemplate>
</tkp:DataGridColumnHeadersPresenter.Template>
</tkp:DataGridColumnHeadersPresenter>
<Border Background="{Binding Path=AlternatingRowBackground,
RelativeSource={RelativeSource AncestorType={x:Type tk:DataGrid}}}"
BorderBrush="#FFB4B4B4"
BorderThickness="1"
CornerRadius="2,0,0,2"
Margin="0,0,0,1"
Width="{Binding Path=CellsPanelHorizontalOffset,
RelativeSource={RelativeSource AncestorType={x:Type tk:DataGrid}}}"/>
Any help or ideas on what might be causing this would be greatly appreciated.
-Michael
|
|
|
|
|
I have a application that is creating many dynamic window form controls and each has its event handlers. When I click on the cancel button I want all the dynamic controls to be disposed. My question is :
1. When the controls are disposed do the event handlers get removed to?
2. If the references to the event handlers are still there after disposing the control, how do i remove the event handlers associated with the dynamic controls. I have a dynamic controls like label, textboxes, checkboxes and combo boxes and each has its event handler. Is there way to unsubscribe all event handlers associated with a control without giving the name of the event handler?
This is sample code that i have written:
foreach (Control childControls in this.NodeIniPanel.Controls)
{
//childControls.Parent.Controls.Remove(childControls);
//this.NodeIniPanel.Controls.Remove(childControls);
if (childControls is TextBox)
{
childControls.Enter -= new EventHandler(tbxKeyValue_Enter);
childControls.Leave -= new EventHandler(tbxKeyValue_Leave);
childControls.KeyDown -= new KeyEventHandler(tbxKeyValue_KeyDown);
}
if (childControls is Label)
{
childControls.Click -= new EventHandler(lblSectionName_Click);
childControls.Click -= new EventHandler(lblSectionKeyName_Click);
childControls.MouseEnter -= new EventHandler(lblSectionName_MouseEnter);
childControls.MouseEnter -= new EventHandler(lblKeyName_MouseEnter);
}
childControls.Dispose();
}
|
|
|
|
|
Hi,
In WinForms there is no need to remove the event handlers at all; they are lists of delegates, and they reside inside the Control, so removing and disposing of the Controls takes care of everything.
Although I haven't looked at WPF in any detail, I see no reason why it would be different there. So IMO you can remove all those -= statements.
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read code that is properly formatted, adding PRE tags is the easiest way to obtain that. All Toronto weekends should be extremely wet until we get it automated in regular forums, not just QA.
|
|
|
|
|
how do I create a text locked, like when I choose a contact in hotmail and this adds to "to" and comes with an x and a pencil, I'm dragging text from a listbox to a richtextbox (WPF) but I want it to have the same style text locked in "to" that adds contacts to send an email in hotmail.
I hope I have understood, thank you very much for your reply
|
|
|
|
|
Hi,
I have a infragistics grid within a WPF user control and I want to expose the mouse double clicked event of the grid. I have multiple instances of this user control on a window
I had two options
1)Grid.MouseDoubleClick += xamDataGrid_MouseDoubleClicked; This worked as expected
2) xamDataGrid1.AddHandler(
DataRecordPresenter.MouseDoubleClickEvent, new MouseButtonEventHandler(GridRowDoubleClick_MouseClick), true);
When I used this, the Grid double clicked event was fired more than once at random for a single double click on the grid.
Pls suggest what could have caused this to fire this event multiple times.
Should I use the removehandler method to unwire the event in my usercontrol unload event.
Pls. advise.
Also suggest, which way is the right way to expose the mouse double click event of the grid.
Thanks,
Suha
|
|
|
|
|
set a counter to make sure you are not getting a double click event, a few micro seconds would work for the timing. make the counter static and zero it out of the first click, of your event gets fired again check the last click time if it is falls within a few microseconds, then cancel the event pumping. Little workaround.. Timers are in the System.Diagnostics framework.
|
|
|
|
|
I am looking for a neat way to hide controls within a grid when the available space is too small to fully display them.
I found this article: http://andyonwpf.blogspot.com/2007/01/how-small-can-you-go.html[^]
However, I dont like the idea of having to subclass all of my controls. Is there a neat way to do the same thing perhaps using value converters?
Cheers
|
|
|
|
|
Hmm, donno, have you tried setting the minimum size to 0?
|
|
|
|
|
I've recently been playing around with the Facebook SDK, and in one of the samples I'm trying to do, I have to add "using Facebook.Entity" as a reference, but this doesn't show up in Intellisense. Why? I'm using the SDK from the Codeplex site, which according to the site is V.3.
I know this might be a bit off topic and I apologize, but there isn't a facebook sdk message board either
|
|
|
|
|
Take a look in the Object Browser and see what VS thinks you have loaded."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
|
|
|
|
|
Well I'm suppposed to add Facebook.Controls.dll to my project as a reference first, but this component was not included in the SDK I donwloaded. I got this download link[^] from the following Codeproject article: "Creating a simple Facebook Application using WPF, By rudigrobler"
|
|
|
|
|
My apologies for the relatively newbie-ish question -- I'm rather new to C# and WPF programming. Here's an object I'm trying to use with strong influence from Pro WPF in C# 2008 (.NET version 3.5) that's supposed to validate a text box's contents:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel;
using System.Windows;
using System.Windows.Controls;
namespace LeanQualityTool
{
public class ValidatedTextBox : TextBox, INotifyPropertyChanged, IDataErrorInfo
{
private string _TextContents = "";
public string TextContents
{
get { return _TextContents; }
set { _TextContents = value;
NotifyPropertyChanged("TextContents");
}
}
public event PropertyChangedEventHandler PropertyChanged;
private void NotifyPropertyChanged(string info)
{
if (PropertyChanged != null)
{
PropertyChanged(this, new PropertyChangedEventArgs(info));
}
}
#region IDataErrorInfo Members
public string Error
{
get { return null; }
}
public string this[string fieldName]
{
get
{
string result = null;
#region For Validating Text
if (fieldName.Contains("Title"))
{
if (this._TextContents.Length == 0)
{
result = "Text should not be blank";
throw new ArgumentException(result);
}
else
{
}
}
#endregion
return result;
}
#endregion
}
}
}
And here's the relevant XAML:
xmlns:vip="clr-namespace:LeanQualityTool"
<vip:ValidatedTextBox Height="23" x:Name="txtJobTitle" HorizontalAlignment="Left" Width="276"
Style="{StaticResource validatedTextBox}">
<TextBox.Text>
<Binding Path="SelectedItem.Title" UpdateSourceTrigger="PropertyChanged"
ValidatesOnDataErrors="True">
</Binding>
</TextBox.Text>
</vip:ValidatedTextBox>
I try to put a breakpoint on the IF statement in the class, but when I debug the app, changing the text in the textbox doesn't even cause the breakpoint to engage. Why isn't the new ValidatedTextBox working?
|
|
|
|
|
Question: You have 3 "if" statements, so which are you putting the breakpoint at?
It looks like you are trying to capture the text change event. Maybe this will point you in the right direction, put a breakpoint on your "set" statement for your "TextContents" property. Run your app and see if it breaks there.
Unless I'm missing something, and I could be cause I'm not up to speed with xaml, but my guess is it won't break there either. You are using a TextBox as the base class. The text box has its own field "Text" for holding the contents. So you will not call the set and then will not call "NotifyPropertyChanged".
The TextBox has an event for text changed where you should put your validation code.
Hope this helps.
|
|
|
|
|
Sorry. My breakpoint was on this line:
if (fieldName.Contains("Title"))
Putting a breakpoint on the "set" statement didn't help, either. I'll look around for the event for text changing contained within TextBox and give it a try. Thanks for your insight.
|
|
|
|
|
You might want to check out the technique I outlined in this blog entry[^] here. Download the code and have a play round with it."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
|
|
|
|
|
Hi
Does anyone know of a Facial Recognition SDK or Application that can easily be integrated into WPF or C#. I'm doing a system for an old age home, and we want to use a webcam and facial recognition to log them in, without them having to remember passwords.
Thanks in advance
|
|
|
|
|
Yes, but they are ment to be run on Nvidia. I recently read a MDSN article on it they are working on it but it has not been released for .NET. Look at some of the CUDA examples and papers of facial recognition.
http://www.arti-vision.com/[^]
|
|
|
|
|
|
Is it possible to dynamic load a 3D xaml ?
if so can you post some links
thank you
|
|
|
|
|
|