|
You could always change it's visibility so that it can't be clicked, and only make it visible when it's the right time to do so.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
Easiest way is just to mask the button. Put a rectangle in the same container that is the width/height of the button and make it transparent. When inside grids, etc, order matters - the rectangle should be represented AFTER the button so it is in the foreground. By default, set the visibility to collapsed. When the user clicks, set it to visible until you are done initializing, then collapse it again. It will mask any clicks or UI events but not fudge the UI.
<Grid>
<Button/>
<Rectangle Fill="Transparent"/>
</StackPanel>
<div class="ForumSig">Jeremy Likness
Latest Article: <a href="http://www.codeproject.com/KB/cs/Collections_Part_1.aspx">Whats in Your Collection? Part 1 of 3: Interfaces</a>
Blog: <a href="http://csharperimage.jeremylikness.com/" target="_blank" title="CSharper Image">C#er : IMage</a></div>
|
|
|
|
|
Does anyone know how to do this? I've looked on every website i could possibly think of and still haven't found what I'm looking for. Basically this is what i want to do/accomplish:
1. I have a pretty big project(around 70k lines ) that I'm trying to add a universal ribbon bar to the top of, each app being able to click through the tabs to get to the common functionality that will be available to that app
2. I have already created the ribbon(thanks to the walkthroughs of uxpassion.com ) that has a nice look and feel for what i want, but it is a WPF application(per the walkthrough) with XAML and a .cs file for all the method calls and functionality the XAML and ribbon require to work
3. I would like to know(if it's possible because i haven't found it anywhere on the web ) if i can use what i have now for my ribbon bar(code and all) and somehow place it at the top of all my different projects' pages so as to have the 2007 Office look no matter what you're looking at
I know this may be a noobie question that i just have overlooked or missed somewhere, but I would really appreciate anything that could help me acheive this(kind of on a deadline) so that my project will look professional
Thanks in advance!
|
|
|
|
|
I'm a bit confused as to what you're actually asking. Are you asking whether you can host none-WPF windows inside the application so that they appear to be running inside a ribbon enabled WPF application? If you are, then yes you can - as long as you add the WindowsFormsIntegration and System.Windows.Forms assemblies as in the following:
<Window x:Class="WpfForm.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:wfi="clr-namespace:System.Windows.Forms.Integration;assembly=WindowsFormsIntegration"
xmlns:wf="clr-namespace:System.Windows.Forms;assembly=System.Windows.Forms"
xmlns:myForm="clr-namespace:MyFormsNamespace;assembly=MyFormsApp"
Title="Host in WPF" Height="400" Width="300"
>
<Grid>
<wfi:WindowsFormsHost>
<myForm:MyWindowForm />
</wfi:WindowsFormsHost>
</Grid>
</Window> In this sample, you can see that I've added the windows form inside the WindowsFormsHost .
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
Thanks Peter for your reply, but I'm guessing that when you said "host none-WPF windows" you meant NON-WPF windows, and the answer is no. All of the projects that have been coded already are in WPF(with a c# back code), and what I would like to do is have a ribbon bar(which I've already created as a WPF application per uxpassion.com) at the top of each of my apps as to give the Office 2007 impression and functionality but with my own code of course I have it set up right now in my ribbon for taking the functions to call from each app, but I haven't got the ribbon to act as a resource ontop of each app's GUI. Does this make sense or clear what I would like to do? Thanks again
|
|
|
|
|
trey white wrote: host none-WPF windows" you meant NON-WPF windows, and the answer is no
No - I meant the UK English language version which is none. The simplest way to achieve what you want is to implement the other applications as user controls.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
oh ok, sorry I misunderstood you. Is there any way you could expand on that a little? Do you mean I would have to add ALL of my apps to my ribbon bar as user controls(kind of like you did with the first response in XAML?) or just implement them through the code behind files? Sorry, I'm no pro at WPF(or the new WPF ribbon bar) and still getting used to it's massive functionality and robustness so any links or sample code would be MUCH appreciated
Thanks again!
|
|
|
|
|
trey white wrote: Do you mean I would have to add ALL of my apps to my ribbon bar as user controls(kind of like you did with the first response in XAML?) or just implement them through the code behind files?
You can do this with either approach - XAML translates into IL in the same way that code behind does. Tell you what, take a look at my article here[^] which should clarify things a lot more.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
Hi,
I have a strange problem I cannot seem to solve. I'm using, in Silverlight, and WebClient to invoke a REST service that returns an XML document.
(the example below shows this document as being accessible via the url: "http://localhost/persons.xml"
This is the callback code from a button defined in my XAML :
Private Sub getdata_Click(ByVal sender As System.Object, ByVal e As System.Windows.RoutedEventArgs)
Dim wcProxy As New WebClient()
Dim Uri As New System.Uri("http://localhost/persons.xml")
'setup delegate
AddHandler wcProxy.DownloadStringCompleted, AddressOf wcProxy_DownloadStringCompleted
' invoke service
wcProxy.DownloadStringAsync(Uri)
End Sub
Private Sub wcProxy_DownloadStringCompleted(ByVal sender As Object, ByVal e As System.Net.DownloadStringCompletedEventArgs)
Dim doc As New XDocument
doc = XDocument.Parse(e.Result) <<< ERRORS HERE <<<<
...
...
End Sub
The error on the line marked above says:
An exception occurred during the operation, making the result invalid. Check InnerException for exception details.
and: e.Error.InnerException.Message says: "Security Error"
Not sure why this is. In at atempt to fix this, I have defined a file called 'clientaccesspolicy.xml' in my ASP.NET Web Application, with te following contents:
<access-policy>
<cross-domain-access>
<policy>
<allow-from>
<domain uri="*">
<grant-to>
<resource include-subpaths="true" path="/">
However - I'm not 100% sure if I need this at all, and even if I did, if I implemented it correctly.
I've made no other changes to the default .WEB project that the Silverlight 'New Project' creates for me.
Thanks - S.
|
|
|
|
|
You should probably make sure e.Error is Nothing before trying to use
e.Result in your DownloadStringCompleted handler.
Are you showing the entire error strings returned in the e.Error exceptions?
If this is a cross-domain issue...
Your clientaccesspolicy.xml needs to be published/copied to the root directory of the
website at the domain you are accessing.
What's in your clientaccesspolicy.xml file?
Here's one that should allow any Silverlight cross domain service calls:
<?xml version="1.0" encoding="utf-8"?>
<access-policy>
<cross-domain-access>
<policy>
<allow-from http-request-headers="*">
<domain uri="http://*"/>
<domain uri="https://*"/>
</allow-from>
<grant-to>
<resource path="/" include-subpaths="true"/>
</grant-to>
</policy>
</cross-domain-access>
</access-policy>
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Thanks. that was part of the problem....
I'm also using Apache not IIS, and couldn't succesfully locate the ROOT folder for the web app hosting the service. I switched to IIS, and, got it working which is enough for me for now.
Thanks again
|
|
|
|
|
Hi All,
I have created a simple wpf Custom control and i am trying to add it to vs2008 toolbox so that it can be drag and dropped as normal standard controls.
But i am not able to add it.
Code to add the custom controls to toolbox is in windows application using VB.
this is the method which i have did.
toolboxtabs.Item("WPFCustomControls").ToolBoxItems.Add("TextBox", "WpfCustomControlLibrary.dll", vsToolBoxItemFormat.vsToolBoxItemFormatDotNETComponent)
Can anyone help me out i am great urgency
Thanks in Advance
|
|
|
|
|
Can you add it using Choose Items... on the toolbox?
modified 27-Feb-21 21:01pm.
|
|
|
|
|
I have to do it Programatically.
I am working in Wpf, Visual studio 2008
Thanks In Advance
|
|
|
|
|
I'm finally getting a chance to work with WPF. Making a Button with an Image on it is no problem as long as I don't mind embedding the image in the resource.
What can't get working is to have it load the image from file in a subfolder under the Application at runtime. I don't want it in the embedded resources.
Any ideas? It must be possible to do.
Happy programming!!
|
|
|
|
|
An easy way to do this is to specify a Uri to the image as in the following code:
myImage.BeginInit();
myImage.Source = new BitmapImage(new Uri(file));
myImage.EndInit(); Obviously, you'll have to pass the fully qualified file name into the Uri, but this code will work.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
How does one go about putting it on the button?
It must be possible but documentation on this topic worse than ever and impossible to find.
Happy programming!!
|
|
|
|
|
There same property you set in XAML, you can set in code.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
It's not that hard to do, and there are plenty of samples on the web. Your XAML looks like this:
<Button>
<Image x:Name="myImage" />
</Button>
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
Thanks for your assistance.
There are heaps of examples that load images from embedded resources for sure. So far I have found only one that half works the way I need it to work.
Happy programming!!
|
|
|
|
|
I'm glad I could help then.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
Hi,
How do I import the DLL Libraries and of Paint.Net and use them in my WPF Application?
Paint.Net is an Open Source Program and it comes bundled with the DLL Libraries but when i try loading them in the WPF/VS08/VS10 it says cannot load the DLL.
Thank You,
Cheers.
|
|
|
|
|
What does it say EXACTLY ?
You're not going to be able to do what you're trying to do, in any case.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
Hi.
I have a strange problem to solve. I am new in WPF. I have a gruop of people(admins) who can modify user interface by Visual Studio and we have group who do not have Visual Studio installed and they are not programmers or admins but they should have a ability to modify user interface - the question is how to do that. Can we store user interface made by Visual Studio in database? Can we make own application which can be used just like Visual Studio by people who are not admins or programmers - this app should load interface from DB and modify it and then save it back to the DB. In this app I need drag/drop functionallity, toolbox with controls loaded from DB and Canvas on which user will modify interface. Finally user can save his work to DB and programmers should have ability to load this interface and open it in Visual Studio.
regards
|
|
|
|
|
mpiotrek wrote: Can we store user interface made by Visual Studio in database?
You could, as long as the UI is done entirely in XAML this isn't too hard to achieve. If you use a pattern like MVVM (google it), you don't need to put code behind the view at all. Alternatively, these users could use Expression Blend which was designed for just this task.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|