|
You make so the window has no border and then you can WPF elements to alter the appearance of the window. If you want to make the windows look the same: create one window with the appearance you want, then make the other windows inherited from the original one.
Regards,
Thomas Stockwell
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
Visit my Blog
|
|
|
|
|
Ok,
how can i make all other elements look the same
like chack boxes, text fields, dropDown lists etc ???
|
|
|
|
|
You can define styles for the controls that will be automatically applied. If you want to do this, I would expect that you have Blend installed - it makes things easier for you.
|
|
|
|
|
i'm searching all around codeproject for some article about exactly that but i can't find it :$
if you know any, could you provide me with link please
|
|
|
|
|
Do an article search for articles by Josh Smith or Sacha Barber.
|
|
|
|
|
i already found some of their articles,
thank you..
however, it's seemed to me that they are too much concrete about topics
but i'll try to look deeper in to WPF on MSDN
thank you
|
|
|
|
|
Your best bet would be to buy a good book on WPF to learn about control styling. I would suggest any of the WPF books from Apress, they have been great additions to my book collection.
Regards,
Thomas Stockwell
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
Visit my Blog
|
|
|
|
|
|
Josh Smith and Sacha Barber write BRILLIANT articles on WPF ... study them intently ...
|
|
|
|
|
I have an ASP.NET control that I bought and I want to use it inside a SL application. Does anyone know how can I do that?
Thanks.
|
|
|
|
|
You can't use ASP.NET in XAML so does Silverlight. But you can show ASP.NET control over Silverlight control. It's all about CSS and HTML thing. Just overlay it on Silverlight DIV.
|
|
|
|
|
Hello there,
I am new to silverlight but i have already had the idea that it is much like Flash.
In this case is it possible to develop a whole offline desktop application
using Silverlight ?
Is that possible too when my target is Windows Mobile ?
Thank You in advance.
Our Philosophy, Mohammed Baqir Al Sadr
|
|
|
|
|
It's possible if you are using Isolated Storage. but actually, Silverlight is not designed for offline application...
|
|
|
|
|
http://silverlight.net/forums/t/22276.aspx[^]
So I still do'nt know the correct information, indeed. Anyway..
It's all becuase I am seraching how to do animation and transparency effects for Windows Mobile application.
Our Philosophy, Mohammed Baqir Al Sadr
|
|
|
|
|
Friends, Please help!
I am writing a WPF application using .net 3.5 and VS 2008. Trying to achieve drag and drop operation.
1. I initiate the dragdrop operation by DragDrop.DoDragDrop in the TreeviewItem's mouseMove event. The second parameter in the DoDragDrop method has a object.
2. I am trying to drop this data onto a textbox. I have coded Drop and DragOver events of the textbox. And I have set the AllowDrop property of the textbox to true.
3. I get the symbol operation not allowed when I am on the textbox. I also notice that neither my dragover and drop events are getting fired.
4. I change the textbox to textblock everything works fine.
5. I also tested this with a ListBox and it works fine too.
6. I need to make this work for textbox, can somebody please help? What am I doing wrong?
I am including my code in the following code block...
void REQNode_MouseMove(object sender, MouseEventArgs e)
{
if (e.LeftButton == MouseButtonState.Pressed)
{
TreeViewItem tvi = sender as TreeViewItem;
dragContext = tvi.Tag as REQRequirement;
DragDrop.DoDragDrop(tvi,dragContext, DragDropEffects.Copy);
}
}
private void txtPostCond_DragOver(object sender, DragEventArgs e)
{
if (e.Data.GetDataPresent(typeof(REQRequirement)))
{
e.Effects = DragDropEffects.Copy;
}
else
{
e.Effects = DragDropEffects.None;
}
}
public void txtPostCond_Drop(object sender, DragEventArgs e)
{
if (e.Data.GetDataPresent(typeof(REQRequirement)))
{
REQRequirement req = (REQRequirement)e.Data.GetData(typeof(REQRequirement));
txtPostCond.Text = req.Description;
}
}
Please Help!
Thank you,
Srini.
|
|
|
|
|
The simplest solution is to start the dragdrop with this line
"DragDrop.DoDragDrop(tvi, dragContext.Description, DragDropEffects.Copy);"
I assume that Description is a string. You can than just forget about the other two events. The textbox already knows how to handle the dragover and dragdrop events with strings.
This is what is causing the behaviour. The textbox already has a command binding for the paste command which handles the two events and marks them as handled.
If you want to drag drop other things than string, you'll have to handle the events before textbox does, and to mark them as hadled so it can't override your settings:
TextBox AllowDrop="True" Drop="TextBlock_Drop" PreviewDragOver="TextBlox_DragOver" PreviewDragEnter="TextBlox_DragOver"
private void TextBlox_DragOver(object sender, DragEventArgs e)
{
if (e.Data.GetDataPresent(typeof(Button)))
{
e.Effects = DragDropEffects.Copy;
}
else
{
e.Effects = DragDropEffects.None;
}
e.Handled = true;
}
|
|
|
|
|
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.
|
|
|
|