|
I'm fairly good with C# and WPF, but I'm relatively new when it comes to working with the new .NET 3.5 WPF RichTextBox control and it's XAML. Anyway, I needed to add a hyperlink insdie a RichTextBox control, so I found instructions on how to do this at http://blogs.msdn.com/llobo/archive/2007/08/09/3-5-features-enabled-hyperlinks-in-richtextbox.aspx[^]">, and I followed the instructions and was able to embed my own hyperlinks inside my own RichTextBox control, and they were lit up blue and underlined, and when I held down the CTRL button and hovered over them, the web browser hand pointer icon appeared, so they seemed to be enabled. However, when I hold down CRTL and click, nothing opens. I've tried this with my own links, and even with the exact same code with the exact same hyperlink on the site above. Am I missing something. What am I doing wrong?
Any help would be appreciated. If you want to reproduce this, just use the code on his site, and you'll see when you hold down Ctrl and Click, nothing actually opens.
Thanks everyone!
Justin
|
|
|
|
|
I've used this way :
XAML:
<Hyperlink Click="Hyperlink_Click" NavigateUri="http://www.mds-soft.persianblog.ir/"><Run
Text="Mohammad Dayyan"/></Hyperlink>
C# :
private void Hyperlink_Click(object sender, RoutedEventArgs e)
{
try
{
Hyperlink source = sender as Hyperlink;
System.Diagnostics.Process.Start(source.NavigateUri.ToString());
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Exception", MessageBoxButton.OK);
}
}
|
|
|
|
|
Hello,
I have encountered a problem trying to draw a line with a custom pen.
What I need to do is draw a line from point X to point Y, but use a certain shape (some polygon), as opposed to the standard pen I get in DrawLine(Pen, Point, Point) interface.
There is the PenLineCap, but it is not good enough as it supports specific shapes.
Anyone has any idea how to achieve this?
Thanks.!
|
|
|
|
|
|
Iam trying to run a WPF Report Viewer(coding in vb).
But its giving the following error
"Report definition file can't be opened, error:\rObject reference not set to an instance of an object."
I have specified the OpenFileDialog.FileName also
But to no avail....
PLEASE HELLLP.....
Best Wishes ....... ARIJIT
|
|
|
|
|
You will need to set a breakpoint, and step over the code that's loading the report definition to find out which variable is null. Without seeing the code, there's no way that we can know.
|
|
|
|
|
I am giving the relevant code :
Private Sub button1_Click(ByVal sender As System.Object, ByVal e As System.Windows.RoutedEventArgs) Handles button1.Click
Dim ofd As OpenFileDialog = New OpenFileDialog()
ofd.Title = "Select report definition file"
ofd.Filter = "Report definition files (*.xml)|*.xml|All files (*.*)|*.*"
If (ofd.ShowDialog() = System.Windows.Forms.DialogResult.OK) Then
Try
' parse file and select report definitions
Dim reports As String() = C1.C1Report.C1Report.GetReportList(ofd.FileName)
If (reports Is Nothing) Or (reports.Length <= 0) Then
Throw New Exception(String.Format("File {0} has no reports definitions.", ofd.FileName))
End If
tbFileName.Text = ofd.FileName
c1DocumentViewer.FileName = ofd.FileName
cbReportName.Items.Clear()
Dim reportName As String
For Each reportName In reports
cbReportName.Items.Add(reportName)
Next
cbReportName.SelectedIndex = 0
Catch ex As Exception
System.Windows.MessageBox.Show(String.Format("Report definition file can't be opened, error:\r{0}", ex.Message), "Error", MessageBoxButton.OK, MessageBoxImage.Error)
c1DocumentViewer.ReportName = ""
c1DocumentViewer.FileName = ""
End Try
End If
End Sub
Please help !
Best Wishes ....... ARIJIT
|
|
|
|
|
Hi.
I have recently started learning WPF. I've written a small app with a tab control on it. I have basically finished it and works fine. But here is the thing... why can't I select the tabs like I can in a normal windows app in the design mode so I can edit controls on that specific tab? I've tried Googling for an answer, but found nothing... which got me thinking that it's not a "general problem" and that I must be doing something wrong???
|
|
|
|
|
Clicking on a TabItem's tab in the design pane should move you to that TabItem's contents.
Also, placing the caret in a TabItem's XAML should move you to that TabItem's contents.
Maybe try it with this:
<TabControl>
<TabItem Header="Tab 1">
<TextBlock Text="Text 1"/>
</TabItem>
<TabItem Header="Tab 2">
<TextBlock Text="Text 2"/>
</TabItem>
<TabItem Header="Tab 3">
<TextBlock Text="Text 3"/>
</TabItem>
</TabControl>
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hello everyone!
I'll try to explain my trouble.
First, I have a LINQ To SQL class with two tables: Talleres and Areas. First table (Talleres) has a field called Area which contains an id of the Areas table, so there's the realtion Talleres.Area --> Area.Id defined at the database and, by extension, at the LINQ to SQL class.
Now, I want to make a form in WPF that presents two comboboxes. In combobox one (TalleresComboBox) there should show the list of Talleres (showing their property Name) and in combobox two (AreasComboBox) there should show the list of Areas (also showing their own property Name). There's also a SubmitButton to submit changes.
The behaviour of this form is very simple buy I can't be able to implement:
Point number 1. If we change the current element of TalleresComboBox, the element of AreasComboBox must autochange to the corresponding value.
Point number 2. We must be able to change the Area field of the Talleres element by changing the current item from AreasComboBox and updating database by pressing SubmitButton.
My code right now is the following:
C# Part
private void Window_Loaded(object sender, RoutedEventArgs e)
{
var Talleres = from row in dc.Talleres_talleres
select row;
TalleresComboBox.DataContext = Talleres;
var Areas = return from row in dc.Talleres_areas
select row;
AreasComboBox2.DataContext = Areas;
}
XAML Part
<Grid Height="354" Width="573">
<ComboBox ItemsSource="{Binding}"
DisplayMemberPath="name"
IsSynchronizedWithCurrentItem="True"
Margin="157,20,0,0" x:Name="TalleresComboBox" HorizontalAlignment="Left" VerticalAlignment="Top" Width="386" Height="23"/>
<ComboBox ItemsSource="{Binding}"
DisplayMemberPath="name"
SelectedValuePath="id"
SelectedValue="{Binding ElementName=TalleresComboBox, Path=SelectedItem.area, Mode=OneWay}"
Height="23" Margin="157,60,0,0" Name="comboBox2" VerticalAlignment="Top" HorizontalAlignment="Left" Width="386" />
<Button Height="23" HorizontalAlignment="Left" Margin="468,309,0,0" Name="button1" VerticalAlignment="Top" Width="75"
Click="button1_Click">Actualizar</Button>
</Grid>
I succedded in point number 1 but not point number 2. I've tried diferent things but no one has been ok.
Please help. Thanks very much.
|
|
|
|
|
Does anyone know of a component available similar to this one that ComponentArt's releasing next year: Click here[^]
It doesn't have to be silverlight exactly. An ajax component like this may work ok also (although I'd assume silverlight would be better for this).
Any ideas?
Thanks.
Regards,
-Goalie35
|
|
|
|
|
Try Zenexis:
http://www.zenexis.com/products/control/tabid/67/p-10-carousel.aspx
|
|
|
|
|
Hi.
Can we play a *.MP3 file in WPF (C#) ?
Any ideas ?
Thank you.
|
|
|
|
|
Mohammad Dayyan wrote: Can we play a *.MP3 file in WPF (C#) ?
Yes.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Mohammad Dayyan wrote:
Can we play a *.MP3 file in WPF (C#) ?
Yes.
Mohammad Dayyan wrote: Any ideas ?
Maybe do a google search on it, or search the article search here.
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
"Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham
|
|
|
|
|
|
You could also use the MediaPlayer class to access Window Media Player directly through C#.
MediaPlayer _mp3Player = new MediaPlayer();
_mp3Player.Stop();
Uri mp3 = new Uri(mp3fileLocation);
_mp3Player.Open(mp3);
_mp3Player.Play();
|
|
|
|
|
I also use SoundPlayer class ( I tested it for *.wav files )
|
|
|
|
|
I need to send a dll file using WCF Service. Please Help me for do this
Dushan Perera
|
|
|
|
|
You could always transfer it as a stream of bytes.
|
|
|
|
|
can u please explain how to do it.
Dushan Perera
|
|
|
|
|
Off the top of my head, it might look something like this:
public class DllFile
{
[DataMember]
public string FileName;
[DataMember]
public byte[] File;
}
[ServiceContract]
public interface IDownload
{
[OperationContract]
DllFile DownloadFile();
}
public class Download : IDownload
{
public DllFile DownloadFile()
{
DllFile dllFile = new DllFile();
dllFile.FileName = <<fullyqualified filename.dll>>
using (FileStream fs = new FileStream(dllFile.FileName, FileMode.Open, FileAccess.Read))
{
dllFile.File = new byte[(int)fs.Length];
fs.Read(dllFile.File, 0, (int)fs.Length);
return dllFile;
}
}
}
|
|
|
|
|
Thanks pal.I check it and see
Dushan Perera
|
|
|
|
|
Thanks Pal. It works.
Dushan Perera
|
|
|
|
|