|
Thanks for you help; however, now I get the following error when I attempt to implement your changes to the XAML for ImageSpace3Dwpf:
Error 1 ''d' is an undeclared namespace. Line 9, position 2.' XML is not valid. C:\Documents and Settings\rDev\My Documents\Expression\Expression Blend Projects\ImageSpace3Dwpf\ImageSpace3Dwpf\ImageSpace3D.xaml 9 2 ImageSpace3Dwpf
|
|
|
|
|
The point is - just add the Loaded event handler.
That's all I changed in the XAML.
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Never mind, I got it. Thanks for all your help
|
|
|
|
|
bdb38865 wrote: Thanks for all your help
No problem!
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
I have a button on a ControlTemplate . I want to handle its click events in the control that uses the template. How would I make that happen?
<ControlTemplate x:Key="UDPTemplateTabControlEx" TargetType="{x:Type TabControl}">
<Grid x:Name="Grid" KeyboardNavigation.TabNavigation="Local">
<ScrollViewer x:Name="HeaderPanelEx" Grid.Row="0" Grid.Column="0"...>
<ScrollViewer.Style>
<Style TargetType="{x:Type ScrollViewer}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate>
<Grid Margin="0,0,0,0" Grid.Row="0" x:Name="HeaderPanelEx">
<Button Grid.Column="0" Width="25" Content="..." />
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ScrollViewer.Style>
</ScrollViewer>
</Grid>
</ControlTemplate>
I tried putting a name property on it, but I still can't see it in intellisense in the code...
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
John Simmons / outlaw programmer wrote:
I did something similar but I used the Command property of the button not the Click event.
<button grid.column="0" width="25" content="..." command="MyCommand" />
Why is common sense not common?
Never argue with an idiot. They will drag you down to their level where they are an expert.
Sometimes it takes a lot of work to be lazy
Individuality is fine, as long as we do it together - F. Burns
Help humanity, join the CodeProject grid computing team here
|
|
|
|
|
John Simmons / outlaw programmer wrote: I want to handle its click events in the control that uses the template. How would I make that happen?
It can also depend on where the template is defined.
If it's in a place backed by code-behind (ie a class) then you can add
an event handler like you would anywhere else.
If the template is in a resource dictionary or some other place without a class
then maybe implementing a command as Wes mentioned would be the way to go.
You can also wire event handlers at runtime, perhaps by overriding OnApplyTemplate()[^] and
using FindName()[^] to find the button instantiated by the template.
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
I'm not sure about the event stuff in WPF yet. I mean, sure, I'm handling click events from buttons and stuff, but I'm not sure about the routed event thing. I haven't found a decent explanation that also includes a decent example of it either. I'm sure that I should look at the routed event stuff, because I'm making controls public in user controls that I have to handle in the form or user control that hosts them, and it just feels wrong to do that.
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
John Simmons / outlaw programmer wrote: I'm sure that I should look at the routed event stuff
Yes. Routed Events Overview[^]
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
For me, custom commands are the way to go, also in terms of clean separation of presentation and logic. You can use the CommandParameter property to submit some contextual information.
Edit: I guess you might derive your command from RoutedCommand if you want it to bubble up the tree, which would simplify handling the event in the control that makes use of the template.
NetDrives - Open Source Network Share Management
|
|
|
|
|
You can also simply data bind the Button.Command to an ICommand on located on the DataContext.
This is excactly how MVVM applications work.
You can also assign the delegate for the ClickEvent or the Commmand at run-time. I've see this also.
Another way is to set up an AttachedEvent at a parent object where this button and possibly others grouped. Then just handle the Button.ClickEvent.
All are very acceptable techniques.
modified 27-Feb-21 21:01pm.
|
|
|
|
|
Hello, I can't install the Toolbox from Silverlight because it stops the installation and show me that it has a problem with my InternetExplorer Version 7. Is there a trick, another download or something special that I missed!?!?! Or require the new Silverlight Toolbox InternetExplorer Version 8?!?!?!?.
Thank's for any help
Frank
|
|
|
|
|
Frank Köppel wrote: I can't install the Toolbox from Silverlight
You mean the Silverlight ToolKIT from the Codeplex site?
If so, the one for Silverlight 2 or the one for Silverlight 3 Beta?
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hello,
I try to use Silverlight_Tools for Version 2.0 because Version 3 is marked as beta!?!?
May I have to try version 3 as well.
Frank
|
|
|
|
|
Version 2 should be what you want, unless you're going to use the beta.
You can't currently have 2 and 3 on the same dev environment.
Make sure you've installed Visual Studio 2008 SP1 and the Silverlight Tools
for Visual Studio 2008 SP1.
What's the error you get?
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Thank's to all, it was my fault!
I've got it running.
Frank
|
|
|
|
|
|
Hi,
I'm working on an small c# test-application as I'm really new to wpf/xaml coding. The App creates a WPF Window with controls and standard dynamic styles.
Runtime I would like to change the style. I don't want to remove and set another style, but get the current style of the control and change things in c# code behind.
I know how to get the style, add new Setter or trigger and remove and the style and add a new style.
What I couldn't find out, if it is possible, is how to change the property values of the given style.
Example: I have an Window with a given "Width" of 600. Now I want to change the width to 300. I could do it in c# I know, but I would like to chagne the given style. Background is, that I would like to save the style in an file and reload it later..
Some Code:
XAML
<br />
<style x:key="MyWindowStyle" targettype="Window" xmlns:x="#unknown"><br />
<setter property="Width" value="600" /><br />
<setter property="Height" value="300" /><br />
</style><br />
C#
<br />
public void SetFirstTemplate()<br />
{<br />
<br />
MyWindowStyle = ((Style)this.Resources["MyWindowStyle"]);<br />
<br />
<br />
}<br />
Has someone experience with that?
|
|
|
|
|
|
Thanks for that Article link, i missed that one.
It's real cool and will be helpful later.
I think I haven't stated out what I really want to achieve.
For now, the purpose of my app is to create something like an style designer.
For that, I need to change the style it self on runtime.
The article assumes you have a number of ready styles you want to change, load and and unload in your skinnable application. That is not what I want to do. I want to change a given simple style to create a new one. When the user is ready with it, it should be saved as an dictionary.xaml file.
What happens then, load into an skinnable app as loose or compiled version doesn't matther at this point.
Thanks again.
|
|
|
|
|
hi i want to show notifications to user when it is uploading.like i want to show the current status while uploading in the label.so can anyone help how to do this in wpf?
|
|
|
|
|
Which part are you having trouble with?
You can set a label's content any time from code as long as you do it on the UI thread.
Have you tried something that isn't working? If so, can you show an example?
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
|
Huh?
Show some code! What have you tried? What's not working?
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hi guys
I use the following line of code to load .chm files whenever the user presses F1 on a textbox:
TextBox h:HelpProvider.HelpString="filename.chm"
But this only works when the .chm file is in the "bin" folder, how can I specify a different path to my help files?
I want to have a seperate folder called "help"
|
|
|
|