|
This is excellent! Thank you very much for your response. You are right I actually worked with preview_dragenter earlier and it was working. It didn't make sense to me. But your response explains it all. Thank you very very much!
- Srini.
|
|
|
|
|
Hi again!
WPF again.. [sight]
I have a simple WPF grid. Furthermore I have two different types of items in this grid, a self defined which inherits from TextBlock and contains PositionX and PositionY - these are my main controls; and TextBlocks whcih do the role of column and rowheaders
---------------
|0|1|2|3|4|5|6|
|1|_|_|_|_|_|_|
|2|_|_|_|_|_|_|
|3|_|X|_|_|_|_|
---------------
So I click on x and with e.Originalsource casted to my Class i get the information inside my object.
What I need now are the Tooltips of the two headers, in this case Tooltip of Textblock in cell 2/0
and the ToolTip of cell 0/3.
As mentioned before those are Type of TextBlock.
A foreach iteration does not work, as the Headers are created this way:
for (int i = 0; i < 65; i++)
{
TextBlock b1 = new TextBlock() { Text = i.ToString(), ToolTip = GetInformationFromXML(i, 0) };
Grid.SetColumn(b1, 0);
Grid.SetRow(b1, i);
g.Children.Add(b1);
if (i != 0)
{
TextBlock b2 = new TextBlock() { Text = i.ToString(), ToolTip = GetInformationFromXML(i, 0) };
Grid.SetColumn(b2, i);
Grid.SetRow(b2, 0);
g.Children.Add(b2);
}
}
So there is no unique name at all.
What I get is
MyObject o = (MyObject)e.OriginalSource;
int X = o.GridPositionX;
int Y = o.GridPositionY;
What I need is
TextBlock tb1 = (TextBlock)grid.GetItem(X,0);
TextBlock tb2 = (TextBlock)grid.GetItem(0,Y);
grid[X][0] does not work.
Can someone please explain me how to retrieve these?
Thank you in advance,
eza
|
|
|
|
|
What you are doing is quite strange ... it's not a good idea to keep important data in the tooltip property.
private UIElement getElement(int column, int row)
{
foreach (UIElement e in MyGrid.Children)
if (Grid.GetColumn(e) == column)
if (Grid.GetRow(e) == row)
return e;
return null;
}
You will have to cast the UIElement to textblock to get the tooltip.
|
|
|
|
|
Thank you for your solution.
Well, concearnig the data in the tooltip:
this project represents a 128x128 matrix, so I cannot use full names for the headers - you couldn't read them any more.
So I thought I pass the full name to the tooltip and retrieve them when hoovering over an item.
the item generates a tooltip which shows the full name of the row and the full name of the column.
The names of the single devices (a.ka headers) are gnereated out of an xml file, so I don't want to open/read/close it every time I create an item (which represents a line between two devices). Either I don't think it's necessary to hold the items in a Dictionary, just for this.
I could use the Tag Property instead, anyway I just need the Text (the full name) of the device.
Do you have any better ideas how this can be done? I would be more than happy to hear them.
Thank you,
eza
|
|
|
|
|
It's nothing wrong with what you did.
I'd still use the Tag property because it can handle any object and not just strings and because you never know when you might need the tooltip property for a real tooltip.
|
|
|
|
|
Hi all, I am creating an app with WPF. In this app when a child window is opened the main window minimizes and show a NotifyIcon. This I have working, however my problem is that in VS 2008 I use the absolute path for the notifyicon (i.e. c:\\Documents and....myicon.ico), which is he only way that works (I am doing the is VB not xaml) but when the app is published and installed on anther computer, I get the cnt find part of the path exception. So I used the pack syntax (pack://application:,,,/Resources/myicon.ico. This way throws exceptions in VS 2008 debug and the published/installed version (the exception is "The given path's format is not supported"). Can somebody tell me what I am doing wrong. The same icon file is being used for the Application icon as well as the Window icon and those work. It is just the System.Drawig.icon that wont work.
nIcon.Icon = New Icon("pack://application:,,/Resources/myIcon.ico")
Regards
modified on Tuesday, August 5, 2008 10:47 AM
|
|
|
|
|
To anyone that is interested this is how I resolved the issue
Dim myIcon As System.Windows.Forms.NotifyIcon = New System.Windows.Forms.NotifyIcon()
Dim myIconUri As New Uri("pack://application:,,,/Resources/myIcon.ico")
...
...
...
myIcon.Icon = New System.Drawing.Icon(Application.GetResourceStream(myIconUri).Stream)
|
|
|
|
|
Hello
Im building an application using WPF and was wondering what was the best practise when storing my WPF DataTemplates. I want to be able to use the datatemplates on the different UI projects.
Im trying to avoid the situation that all the developers have their own DataTemplates. If one developer has created a DataTemplate for an object, this shall be used.
Need idees on how this is best solved
Cheers
Spaz
|
|
|
|
|
It sounds like you would be best off putting the DataTemplates in a class library and referencing that dll from every project that should use the shared templates. Once you do that, you can reference the templates like this:
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary
Source="pack://application:,,,/(name of dll without extension);component/DefaultStyles.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
Notice that the resources in your external dll are broken down by file. So if you have different groups of templates or styles or whatever resources, this allows you to reference only the resources you want.
|
|
|
|
|
|
Good People,
I have a storyboard that plays an animation. When the user clicks a button, how do I make the storyboard go in reverse?
Thanks,
BP
|
|
|
|
|
Well, you could take a look at this[^] article.
|
|
|
|
|
hi Michael you Know what is the solution for this error like
1 Error:The name 'InitializeComponent' does not exist in the current context in silverlight ...
Plz reply me
Raaj
|
|
|
|
|
InitializeComponent method is in generated file(partial class). For example. Your page is SilverlightPage.cs and the generated file would be SilverlightPage.g.cs. That InitializeComponent method will be included in that generated file.
if you are getting this error, maybe, your class (e.g. SilverlightPage.cs) and the generated class (SilverlightPage.g.cs) are under different namespace. So, please take a look at the XAML and check the namespace..
|
|
|
|
|
how we can get httpwebrequest in xaml apllication.plz reply me
Raaj
|
|
|
|
|
If you are using Silverlight 2 Beta2, there is a class called HttpWebRequest. (I think it's under System.Net namespace)
Hope it helps.
|
|
|
|
|
thanks...
I am using system.net namespace.even its not comming..
Raaj
|
|
|
|
|
|
actually that is .Xaml file(WpfBrowserApplication)..system.net.httpwebrequest is not comming..
Raaj
|
|
|
|
|
r aa j wrote: that is .Xaml file(WpfBrowserApplication).
Steps:
1) Go to the solution explorer of your project.
2) Right-click on reference node.
3) Select "Add Reference"
4) Find "System.Net" assembly and add it.
5) Go to your code
6) Type "System.Net.HttpWebRequest" (then, you will get it.)
The steps work in WPF, Xbap, Silverlight 2 beta1/2.
Note: This forum is dedicated for Silverlight question only. If you want to ask any question related to Xbap (WPF Browser Applcation), please ask in WPF/WCF/WF forum of Codeproject.
|
|
|
|
|
|
hi Michael you Know what is the solution for this error like
1 Error:The name 'InitializeComponent' does not exist in the current context in silverlight
Raaj
|
|
|
|
|
Hello,
I am new to WPF and I want to learn it as fast as I can :P I can't wait to give these new 3D effects to the applications I want to create. I found this cool 3d flip feature in this site
http://www.interact-sw.co.uk/iangblog/2007/05/17/wpf-flippable-3D-list[^]
Its purely made in XAML, but i know we can use Visual Studio 2008 and VB.NET to create effects like these... i tried to look for any kind of a tutorial on the net but i didn't get any which could teach me flipping controls in WPF windows in this manner.
If anyone could help me out I would be grateful
thank you
|
|
|
|
|
Why don't you just download the source for that page and work through it?
|
|
|
|
|
yes i have downloaded the xaml source code of that page... and am also trying to understand it... its pure XAML and i have no experience at all about it... but we can implement that using programming code in vb.net 2008 wpf if i am not wrong? so i was wondering if there is any proper tutorial which can guide me in what i want to achieve
|
|
|
|