|
Hi Pete,
i'm happy for your care and support and i'm waiting with trust your next project.
Sure i will learn a lot... i need to learn and study a lot
However i wish you a nice work and thanks a lot for your precious support .
Nice regards,
Bye
|
|
|
|
|
Hey everyone,
I am doing my first WPF User control. I am trying to get my hyperlink to open a new IE browser when I press a on my "link label".
my code sampel;
<DataTemplate x:Key="resultLayout" DataType="WPFSearchResult">
<StackPanel Orientation="Vertical">
<TextBlock Foreground="Blue">
<Hyperlink Name="hl" RequestNavigate="HandleRequestNavigate" FontSize="14" NavigateUri="http://www.microsoft.com">
<TextBlock Text="{Binding Path=Header}"/>
</Hyperlink>
</TextBlock>
</StackPanel>
</DataTemplate>
When I press on the HyperLink nothing happen.
This is a sampel of my code behid class;
namespace WpfShowResultsControl
{
public partial class GetSearchResultUserControl : UserControl
{
public GetSearchResultUserControl()
{
InitializeComponent();
}
void HandleRequestNavigate(object sender, RoutedEventArgs e)
{
string navigateUri = hl.NavigateUri.ToString();
Process.Start(new ProcessStartInfo(navigateUri));
e.Handled = true;
}
}
}
I have tried many eksampels on diffrent forums and I cannot get it works. I have also tried like this <Hyperlink x:Name="hl".....>
In my code behind class, I cannot use hl, it looks like it does not exist. What can I do to get hl useable? Could any one please advice me what I am missin in my code. Many thanks in advance!
|
|
|
|
|
hi
you can try this:
make an click event on you textblok.
and in you click event call:
System.Diagnostics.Process.Start("http://www.google.de");
|
|
|
|
|
From [^]
"Hyperlink is "navigation service" aware, which means it can work properly as you expect in navigation application(using NavigationWindow, Frame which can provide navigation service).
In standalone non-navigation application, you can hook up to its Click event, and implement the navigation logic there."
So, in your case you will need to use click handler as suggested ^^
|
|
|
|
|
I hope you found this useful :
private void Windows_Loaded(object sender, RoutedEventArgs e)
{
AddHandler(Hyperlink.ClickEvent, (RoutedEventHandler)Hyperlink_Click);
}
private void Hyperlink_Click(object sender, RoutedEventArgs e)
{
if (e.OriginalSource is Hyperlink)
{
Process.Start((e.OriginalSource as Hyperlink).NavigateUri.AbsoluteUri);
e.Handled = true;
}
}
|
|
|
|
|
Hi Guys,
Any one has idea on how to host a workflow designer inside a ASP.NEt page.
Thanks in advance for your suggestions
Sree
Thanks
Laddie
Kindly rate if the answer was helpful
|
|
|
|
|
This[^] might serve as a starting point.
|
|
|
|
|
Thank you pete.
Thanks
Laddie
Kindly rate if the answer was helpful
|
|
|
|
|
Hi
I am trying to create and start an animation in code instead of using xaml. When I use the Storyboard object(second example) nothing happens(There are no visible results of the animation), if I set animation's properties and start it without using the Storyboard object everything works normaly(first example). Below is the sample code which is put in the event handler for a button which is on the UserControl.
//This works normaly
btn_Click(object sender, RoutedEventArgs e)
{
LinearGradientBrush mask = new LinearGradientBrush();
GradientStop transparentStop = new GradientStop(Colors.Transparent, 0);
GradientStop visibleStop = new GradientStop(Colors.Black, 0);
mask.GradientStops.Add(transparentStop);
mask.GradientStops.Add(visibleStop);
this.OpacityMask = mask;
DoubleAnimation visibleStopAnimation = new DoubleAnimation(0, 1.2, TimeSpan.FromSeconds(1.2), FillBehavior.HoldEnd);
visibleStop.BeginAnimation(GradientStop.OffsetProperty, visibleStopAnimation);
}
//This doesn't work
btn_Click(object sender, RoutedEventArgs e)
{
LinearGradientBrush mask = new LinearGradientBrush();
GradientStop transparentStop = new GradientStop(Colors.Transparent, 0);
GradientStop visibleStop = new GradientStop(Colors.Black, 0);
mask.GradientStops.Add(transparentStop);
mask.GradientStops.Add(visibleStop);
this.OpacityMask = mask;
Storyboard story = new Storyboard();
story.Duration = TimeSpan.FromSeconds(1);
DoubleAnimation visibleStopAnimation = new DoubleAnimation(0, 1, TimeSpan.FromSeconds(1), FillBehavior.HoldEnd);
Storyboard.SetTarget(visibleStopAnimation, visibleStop);
Storyboard.SetTargetProperty(visibleStopAnimation, new PropertyPath("(Offset)"));
story.Children.Add(visibleStopAnimation);
story.Begin();
}
Does anybody has any idea? Any advice will be appreciated!
Uros
|
|
|
|
|
When you work with Storyboards in code you need to use RegisterName. You can learn more about the "why" here:
Storyboards Overview (MSDN)[^]
LinearGradientBrush mask = new LinearGradientBrush();
GradientStop transparentStop = new GradientStop(Colors.Transparent, 0);
GradientStop visibleStop = new GradientStop(Colors.Black, 0);
mask.GradientStops.Add(transparentStop);
mask.GradientStops.Add(visibleStop);
this.OpacityMask = mask;
NameScope.SetNameScope(this, new NameScope());
this.RegisterName("visibleGradientStop", visibleStop);
DoubleAnimation visibleStopAnimation = new DoubleAnimation(0, 1, TimeSpan.FromSeconds(1), FillBehavior.HoldEnd);
Storyboard story = new Storyboard();
story.Duration = TimeSpan.FromSeconds(1);
story.Children.Add(visibleStopAnimation);
Storyboard.SetTargetName(visibleStopAnimation, "visibleGradientStop");
Storyboard.SetTargetProperty(visibleStopAnimation, new PropertyPath(GradientStop.OffsetProperty));
story.Begin(this);
|
|
|
|
|
Thank you gurge60, that solved my problem.
|
|
|
|
|
Hello All, I'm kinda new in this field and want your help.
The problem is, that I want to create a custom treeview and I want that treeview to take it's template ,styles and setters from a dictionary, and do that in a "WPF CustomControl Library" (project type)
how can I do That ?
Thanks in advance
|
|
|
|
|
Do you have Blend? When you create a template Blend asks you where you want to define it. You can then choose to define it in a resource dictionary.
If not using Blend, I think you just define the template or style in the resource dictionary, then reference it in the XAML.
|
|
|
|
|
Hi there,
first of all: I'm quite new to WPF. The current project is to help me learn working with it.
I'm trying to make a window that is much like an ICQ window: http://bb.nfshost.com/icqNormal.jpg[^].
Items in there shall be collapsable like this: http://bb.nfshost.com/icqCollapsed.jpg[^]. I'd like to use Expander to achieve this.
Now, on to my problem(s). I want it all to size to the content. For the main window that's simple, as I found the SizeToContent="WidthAndHeight" property.
For the rest, well, I was trying around a few hours without any working results. Currently, my XAML looks like this:
<Grid>
<DockPanel Margin="0,0,78,0" Name="dockPanel1" VerticalAlignment="Top">
<Expander Header="test 1" Name="expander1">
<Grid>
<StackPanel Name="stackPanel1">
<Label Height="28" Name="label1" Width="120">Label2</Label>
<Label Height="28" Name="label2" Width="120">Label2</Label>
<Label Height="28" Name="label3" Width="120">Label2</Label>
<Label Height="28" Name="label4" Width="120">Label2</Label>
</StackPanel>
</Grid>
</Expander>
</DockPanel>
<DockPanel Margin="0,0,78,169" Name="dockPanel2" VerticalAlignment="Bottom">
<Expander Header="test 2" Name="expander2" VerticalAlignment="Bottom">
<Grid>
<StackPanel Name="stackPanel2">
<Label Height="28" Name="label5" Width="120">Label 0</Label>
<Label Height="28" Name="label6" Width="120">Label 0</Label>
<Label Height="28" Name="label7" Width="120">Label 0</Label>
<Label Height="28" Name="label8" Width="120">Label 0</Label>
</StackPanel>
</Grid>
</Expander>
</DockPanel>
</Grid>
Note: The content is supposed to be unknown, and variable in size.
What this sadly does, is put both expanders in the same place, covering each other. Anyone there who might help me out?
Thanks in advance
|
|
|
|
|
Well, this works for me:
<StackPanel Orientation="Vertical">
<DockPanel Name="dockPanel1" VerticalAlignment="Top">
<Expander Header="test 1" Name="expander1">
<StackPanel Name="stackPanel1">
<Label Height="28" Name="label1" Width="120">Label2</Label>
<Label Height="28" Name="label2" Width="120">Label2</Label>
<Label Height="28" Name="label3" Width="120">Label2</Label>
<Label Height="28" Name="label4" Width="120">Label2</Label>
</StackPanel>
</Expander>
</DockPanel>
<DockPanel Name="dockPanel2" VerticalAlignment="Bottom">
<Expander Header="test 2" Name="expander2" VerticalAlignment="Bottom">
<StackPanel Name="stackPanel2">
<Label Height="28" Name="label5" Width="120">Label 0</Label>
<Label Height="28" Name="label6" Width="120">Label 0</Label>
<Label Height="28" Name="label7" Width="120">Label 0</Label>
<Label Height="28" Name="label8" Width="120">Label 0</Label>
</StackPanel>
</Expander>
</DockPanel>
</StackPanel>
|
|
|
|
|
Or you could put it in a Grid and get rid of the VerticalAlignments:
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<DockPanel Grid.Row="0" Margin="0,0,78,0" Name="dockPanel1" >
<Expander Header="test 1" Name="expander1">
<Grid>
<StackPanel Name="stackPanel1">
<Label Height="28" Name="label1" Width="120">Label2</Label>
<Label Height="28" Name="label2" Width="120">Label2</Label>
<Label Height="28" Name="label3" Width="120">Label2</Label>
<Label Height="28" Name="label4" Width="120">Label2</Label>
</StackPanel>
</Grid>
</Expander>
</DockPanel>
<DockPanel Grid.Row="1" Margin="0,0,78,169" Name="dockPanel2" >
<Expander Header="test 2" Name="expander2" >
<Grid>
<StackPanel Name="stackPanel2">
<Label Height="28" Name="label5" Width="120">Label 0</Label>
<Label Height="28" Name="label6" Width="120">Label 0</Label>
<Label Height="28" Name="label7" Width="120">Label 0</Label>
<Label Height="28" Name="label8" Width="120">Label 0</Label>
</StackPanel>
</Grid>
</Expander>
</DockPanel>
</Grid>
modified on Wednesday, March 25, 2009 6:52 PM
|
|
|
|
|
Hi,
I tried to use ApplicationCommands.Paste for a web browser application but it doesn't work. I used this command for window application and it worked. Is there anyone who has an idea to solve this problem. Thanks.
|
|
|
|
|
This is not a paid support forum - please don't attempt to push your post to the top when you've published the same one so recently. It's not good form.
|
|
|
|
|
If you dont have an answer why are you making comment. I am aware this isn't a paid support forum. I just want to solve a problem and get some help. I dont get what is wrong with it.
|
|
|
|
|
The etiquette of the forum is that you don't bump posts. The reason that people haven't answered your original post can be many and varied, perhaps the person who can answer it hasn't got round to viewing it yet, or perhaps the wording isn't done particularly well and people can't understand it, or perhaps somebody is putting text together to answer it, but hasn't gotten around to post a sample yet.
In any of these cases, you are doing other posters a disservice when it comes to your bumping your post. Suppose everybody decided to do this - it would become impossible to answer questions properly because you couldn't get a dialogue going with somebody because their post would disappear under a blizzard of crap.
|
|
|
|
|
OK, I have to admit that this makes me a bit, well, ticked...
How is something that is supposed to be a web technology for up-to-date cool looking web stuff lacking these features:
1) The ability to send an email without having to drop down and write a web service to do it?
2) The ability to post a blocking and modal dialog box to the user.
Geeeeeze...
And I was really starting to like Silverlight...
|
|
|
|
|
Ray Cassick wrote: 1) The ability to send an email without having to drop down and write a web service to do it?
Silverlight is client-technology. It runs on the browser. Can you send a mail from Javascript without using web service, web server or ActiveX object??
Ray Cassick wrote: 2) The ability to post a blocking and modal dialog box to the user.
I'm not sure what you meant.
|
|
|
|
|
Michael Sync wrote: Silverlight is client-technology.
OK, I can kind of get that aspect of it now... I guess my problems were partly my ignorance of the technology there. It is still sinking in...
|
|
|
|
|
About e-mail you have to go WCF and then in the server side use that service. Even if you could send an email to an SMTP server from silverlight you would have to set your credentials in your client code... this means... an spammer would be quite happy to dessasembly your code get the credentials and use them to rely on your SMTP and send tones of nonsense emails.
On the other hand, you create modal popups (I used them on my app), the result that you get is similar to the AJAX ASP .net modal popup.
Thanks
Braulio
/// -------------------------
Braulio Díez
DBSchemaEditor.com
Free Silverlight based DB Schema Modeling Tool
/// -------------------------
|
|
|
|
|