|
Is this what you're looking for?
namespace MyNamespace
{
public partial class MyUserControlBase : UserControl
{
public MyUserControlBase()
{
}
}
public partial class MyUserControl : MyUserControlBase
{
public MyUserControl()
{
InitializeComponent();
}
}
}
<local:MyUserControlBase x:Class="MyNamespace.MyUserControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:MyNamespace"
Height="300" Width="300">
<Grid>
</Grid>
</local:MyUserControlBase>
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hi,
In my WPF application I have a requirement where in user can drag-and-drop an email (.msg file) either from the file system OR MS Outlook. When user drags-and-drop the .msg file from the file system the file gets added. But when user drags-and-drop a .msg file from MS Outlook, it throws following exception
Exception from HRESULT: 0x80040068 (DV_E_LINDEX
I have implemented the below code & I encounter error on below line
MemoryStream ms = (MemoryStream)e.Data.GetData("FileContents", true);
string[] fileNames = null;
if (e.Data.GetDataPresent(DataFormats.FileDrop, false))
{
fileNames = e.Data.GetData(DataFormats.FileDrop, true) as string[];
foreach (string fileName in fileNames)
{
FileInfo fileInfo = new FileInfo(fileName);
}
}
else if (e.Data.GetDataPresent("FileGroupDescriptor"))
{
Stream theStream = (Stream)e.Data.GetData("FileGroupDescriptor");
byte[] fileGroupDescriptor = new byte[512];
theStream.Read(fileGroupDescriptor, 0, 512);
StringBuilder fileName = new StringBuilder("");
for (int i = 76; fileGroupDescriptor[i] != 0; i++)
{
fileName.Append(Convert.ToChar(fileGroupDescriptor[i]));
}
theStream.Close();
string path = Path.GetTempPath();
string theFile = path + fileName.ToString();
MemoryStream ms = (MemoryStream)e.Data.GetData("FileContents", true);
byte[] fileBytes = new byte[ms.Length];
ms.Position = 0;
ms.Read(fileBytes, 0, (int)ms.Length);
FileStream fs = new FileStream(theFile, FileMode.Create);
fs.Write(fileBytes, 0, (int)fileBytes.Length);
fs.Close();
FileInfo tempFile = new FileInfo(theFile);
if (tempFile.Exists)
{
tempFile.Delete();
}
What might be the issue here? Kindly help.
Regards,
Vipul Mehta
|
|
|
|
|
I'm using ComponentOne Grid for WPF with VS2008 SDK 3.5, and Iam recieving the following error when I compile a project:
Error 1 Task failed because "LC.exe" was not found, or the correct Microsoft Windows SDK is not installed. The task is looking for "LC.exe" in the "bin" subdirectory beneath the location specified in the InstallationFolder value of the registry key HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v6.0A. You may be able to solve the problem by doing one of the following: 1) Install the Microsoft Windows SDK for Windows Server 2008 and .NET Framework 3.5. 2) Install Visual Studio 2008. 3) Manually set the above registry key to the correct location. 4) Pass the correct location into the "ToolPath" parameter of the task.
This comes after I add the third party control to a form. If I don't add the control and run the project after creating a new project(WPF Application) it runs fine. I can't find the the "ToolPath" parameter also. I tried uninstalling and reinstalling the SDK and Component One but it gave the same error.
Is this a problem with the project, or the third party stuff???
Best Wishes ....... ARIJIT
|
|
|
|
|
Have you asked ComponentOne?
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
I would get in touch with ComponentOne and raise a support call on this. LC.exe generates a .NET license file to add to the manifest, so I would be asking them why you need to add the license file.
|
|
|
|
|
HI all,
i need a feature about add,edit and delete a record ,in few words my boss request to insert a password when a employee will add,delete and edit a record but i have not idea how do that.
Do you have advices ,ideas or some link to see how apply this feature.
I use Wpf with Linq toSQL .
Thanks for your attention.
I wish you happy work.
Best regards,
Bye
|
|
|
|
|
Do you mean that a user should login to your app at startup or enter a password on a single window at the same time as submitting these new/changed details?
I'd opt for having a login when the app started personally.
Does the database your using already have any form of user login/security mechanism? If not, this isn't a trivial thing to implement.
|
|
|
|
|
Hi JAmmer,
firstly thanks to reply me,
my database hasn't a security or better i did not put a password in my SqlServer
Jammer wrote: Do you mean that a user should login to your app at startup or enter a password on a single window at the same time as submitting these new/changed details?
I mean (my boss request ) that when a employee will add,delete or edit a record before to perform that action must appear a password to complete the action (add,delete,edit) ,he is a little pedantic because he got afraid that somebody will change the data without his permission .
I'm interested having a login when the app start ,can you explain me more in detail about this option?
Thanks
I wish you happy day.
Best Regards,
Bye
|
|
|
|
|
If you want to have a login at app start your going to have to implement some form of security database.
This is a fair sized project in its own right.
You'll have to authenticate users at login, store hashed passwords and possibly implement some form of 'user roles' that have a selection of permissions regarding things they are allowed to do and things they aren't allowed to do.
If your going to all this trouble you should also be logging what a user does, when they did it etc ...
Sounds to me like you would be wise to actually tell your boss that this is potentially a lot of work.
Its the kind of infrastructure thing that needs planning and doing in such a way that it is application independant as well. So any future apps you develop can also make use of this security model.
This is also drifting way off topic for this forum!
|
|
|
|
|
The advice that Jammer has given you is good stuff, but there is something else you can do. In ASP.NET, there is the concept of something called the Membership and Role Providers, which are used to provide authentication on a website. There's a common misconception that they can only be used on a website - this just isn't true. With a little bit of work, you can hook up a desktop application to use the same infrastructure.
Here's[^] a Win Forms example that should be relatively easy to port over.
|
|
|
|
|
Thats really interesting ...
Thanks for that Pete.
|
|
|
|
|
Hi,
Thanks for your fast reply,
i will look right now the link and after i will try ,however i will tell you if i try difficult or not.
A special warm hug...so far so good.
I wish you happy day.
Best Regards,
Bye
|
|
|
|
|
|
Thanks a lot for your lovely support.
when i will develop it i will tell you how is it..
i wish you happy day.
Best regards,
Bye
|
|
|
|
|
Hi
I'm looking for an IP Text box implementation, either with a mask or windows style (4 boxes, with the abillity to copy\paste etc)
Any one has done it before?
Thanks,
|
|
|
|
|
You can find something like that in the downloadable code examples for the Apress book PRO WPF by Matthew MacDonald(Chapter 24) but it doesn't support the paste/copy functionallity. I hope this helps
Uros Bregar
|
|
|
|
|
Hi all,
I am developing XBAP application and facing following problem.
I have created one WPF user control and trying to access it dynamycally using reflection. Project contains Page1.xaml, Page2.xaml and userControl1.xaml. Actually when project starts page1 is hosted inside browser. when button is clicked new instance of Page2 is created and hosted inside frame and instance of userControl1 is also created and placed on the page2. AS you go on clicking button same thing happened and those many pages are hosted inside the frame. but the Problem is when I navigate between these pages user control loses its state. if I place the usercontrol at design time then it does not lose the state during navigation. here is my code in button click
Dim Pg As New Page2
fraHost.Content = Pg
and code in the Page2.loaded event is as follows
Dim asm As Assembly = Assembly.LoadFrom(AppDomain.CurrentDomain.BaseDirectory & "WpfBrowApp.exe")
Dim flags As BindingFlags = BindingFlags.NonPublic Or BindingFlags.Public Or BindingFlags.Static Or _
BindingFlags.Instance Or BindingFlags.DeclaredOnly
Dim ref_types As Type() = asm.GetTypes()
'StrSearchControl is the name of usercontrol
Dim typ As Type = asm.GetType(asm.GetName.Name & "." & StrSearchControl, True, True)
Dim instance As Object
For Each ty As Type In ref_types
If ty.Name = StrSearchControl Then
instance = Activator.CreateInstance(ty)
instance.height = Double.NaN
instance.width = Double.NaN
instance.ishittestvisible = True
Me.tbpgSreen.Content = instance
End If
Next
please help me on this.
thanks in advance.
Prabi
|
|
|
|
|
Hi,
I am using a web browser control in my WPF application. I will be navigating various websites with its help. What i want is that when a certain web page gets loaded, based on the content inside that web page i should be able to identify the language which is written on that page like french , japanese etc.
Basically i want to apply the concept of Internationalization or something like that in WPF.
In internationalization we can get the web browser's language preferences by:
// Set the CurrentCulture property to the culture associated with the Web
// browser's current language setting.
Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture(Request.UserLanguages[0]);
I want the same thing for the web page that i navigate through my web browser control in WPF.
It's kind of urgent please help to find the solution soon.
Thanks in advance.
|
|
|
|
|
Hi,
I was wondering what is better for performance in WPF.
Drawing in code or using image files.
and if so, what is the best format
Thanks
|
|
|
|
|
Well, I think so using images is faster, but with XAML you can draw vector shapes as well as shapes in Flash.
It depends your want.
|
|
|
|
|
Thanks,
I just want to know, when designing a new application, which approach is best
|
|
|
|
|
If I wanna design an application , I'll use XAML code.
|
|
|
|
|
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.!
|
|
|
|