|
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
|
|
|
|
|
Ok. I understand. Interface would be in XAML. But what with events for example ondrag, onclick etc. Is this a big deal?
|
|
|
|
|
Take a look at MVVM - you can separate your logic out into something called a ViewModel. I wrote an article[^] a couple of months ago that used MVVM and there's virtually no code behind the views. Download it, read through the code, and read up on the pattern. Sacha Barber's currently running a series on MVVM in WPF that is well worth reading, and you can find more information from the likes of Josh Smith and Karl Shifflett.
"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 am writing a WPF application (www.tabbles.net) with file managament capabilities. I need to show the same file context menus that Explorer does. I assume I have to query all shell extensions installed on the user's machine. In particular, for each shell extension, I have to invoke IContextMenu::QueryContextMenu[^]. The problem is that QueryContextMenu requires an HMENU as argument, but I am using the WPF ContextMenu class, which does not seem to have a method for obtaining an HMENU. How can I obtain the required HMENU to pass to the QueryContextMenu? Thanks a lot for any solution or workaround to my problem.
modified on Monday, August 17, 2009 5:09 AM
|
|
|
|
|
HMENU is actually a handle to the menu. In order to get a handle, you need to wrap your context menu in a HwndSource object, which gives you the handle you need.
"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 Guys
I want to add a selection effect to my 3d models so that when I select a model it fades to another color, and when deselecting it, it should fade back to it's original color again. The idea I have is to create a Storyboard, and somewhere in the code behind start the Storyboard when a certain model is selected, but, how would I go about specifying the actual fade effect e.g brown to red?
|
|
|
|
|
You could do this using a ColorAnimationUsingKeyFrames as in the following sample:
<Window
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Class="FadeSample.Window1"
x:Name="Window"
Title="Window1"
Width="640" Height="480">
<Window
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Class="FadeSample.Window1"
x:Name="Window"
Title="Window1"
Width="640" Height="480">
<Window.Resources>
<Storyboard x:Key="OnClick1">
<ColorAnimationUsingKeyFrames
BeginTime="00:00:00" Storyboard.TargetName="button"
Storyboard.TargetProperty="(Panel.Background).(SolidColorBrush.Color)">
<SplineColorKeyFrame KeyTime="00:00:01" Value="#FFEF1407"/>
</ColorAnimationUsingKeyFrames>
</Storyboard>
</Window.Resources>
<Window.Triggers>
<EventTrigger
RoutedEvent="ButtonBase.Click" SourceName="button">
<BeginStoryboard Storyboard="{StaticResource OnClick1}"/>
</EventTrigger>
</Window.Triggers>
<Grid x:Name="LayoutRoot">
<Button
HorizontalAlignment="Left"
VerticalAlignment="Top"
Content="Button"
RenderTransformOrigin="3.339,5.055"
Margin="120,115,0,0"
Background="#FFDF891A"
x:Name="button"/>
</Grid>
</Window>
"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 the code sample, appreciate it very much.
Will try it as soon as possible and report back
|
|
|
|
|
Okay I understand how this works, but in the sample you gave me the Storyboard.TargetProperty is = (Panel.Background) . How would I specify the animation to applied to a ModelVisual3D(3D model) instead? Also remember, the ModelVisual3D's aren't specified in the xaml, it get's rendered at runtime.
|
|
|
|
|
Hi
I defined a Style in my xaml to be used on all Groupboxes, but there's ONE groupbox's background property that has to be different from the others. I tried setting this property in the code behind, but no luck. Any ideas?
Here's the code for the style:
<!--A style that formats all groupboxes--><br />
<Style TargetType="GroupBox"><br />
<Setter Property="Template"><br />
<Setter.Value><br />
<ControlTemplate TargetType="GroupBox"><br />
<Grid><br />
<Grid.RowDefinitions><br />
<RowDefinition Height="Auto"/><br />
<RowDefinition Height="*"/><br />
</Grid.RowDefinitions><br />
<Border Grid.Row="0" BorderBrush="White" BorderThickness="2,2,2,1" CornerRadius="0,12,0,0" ><br />
<ContentPresenter Margin="4" ContentSource="Header" RecognizesAccessKey="True" /><br />
</Border><br />
<Border Grid.Row="1" BorderBrush="White" BorderThickness="2,0,2,2" CornerRadius="0,0,0,12" ><br />
<ContentPresenter Margin="4" /><br />
</Border><br />
</Grid><br />
</ControlTemplate><br />
</Setter.Value><br />
</Setter><br />
</Style>
|
|
|
|
|
If all you need to do is have one groupbox that behaves slightly differently to the others in it's styling, all you need to do is create a new style that targets a groupbox, and give it a key. By default, (as long as you add it after the groupbox above) it will inherit the settings of the groupbox, and you can change the background property as appropriate. All you need do then is apply the style to the groupbox in question - you have the key to use here.
"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
|
|
|
|
|
"All you need do then is apply the style to the groupbox in question - you have the key to use here. "
This is exactly my question, how do I apply this specific style to the specific groupbox?
|
|
|
|
|
Okay nevermind I got what you were saying
|
|
|
|
|
Hi
I may have trouble to explain my problem but I will try. I have made a
Silverlight Application, in which I added a WCF Service. I added the
servicereference to the project. When I run it in VS it works great and when
I publish it in IIS it works great. But when I'm trying to deploy or what
it's called on the webserver, it gives me the error 405 . I can see in the web development helper that it doesn't download, or what that is called, the
clientaccesspolicy.xml. The clientaccesspolicy.xml and crossdomain.xml file
are placed in the root.
This is my web.config
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior name="AcceditWeb.Web.ServiceBehavior">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
</behaviors>
<services>
<service behaviorConfiguration="AcceditWeb.Web.ServiceBehavior"
name="AcceditWeb.Web.Service">
<endpoint address="" binding="basicHttpBinding"
contract="AcceditWeb.Web.IService">
</endpoint>
<endpoint address="mex" binding="mexHttpBinding"
contract="IMetadataExchange" />
</service>
</services>
</system.serviceModel>
</configuration>
This is my ServiceReference.config which is placed in AcceditWeb.xap in the directory
ClientBin
<code>lt;configuration>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_IService"
maxBufferSize="2147483647"
maxReceivedMessageSize="2147483647">
<security mode="None" />
</binding>
<binding name="BasicHttpBinding_IService1"
maxBufferSize="2147483647"
maxReceivedMessageSize="2147483647">
<security mode="None" />
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://thewebsite.thewebserver.se/Service.svc"
binding="basicHttpBinding"
bindingConfiguration="BasicHttpBinding_IService1"
contract="ServiceReference.IService"
name="BasicHttpBinding_IService" />
</client>
</system.serviceModel>
</configuration>
This is my clientaccesspolicy.xml file
<?xml version="1.0" encoding="utf-8"?>
<access-policy>
<cross-domain-access>
<policy>
<allow-from http-request-headers="SOAPAction,Content-Type">
<domain uri="*" />
</allow-from>
<grant-to>
<resource path="/" include-subpaths="true"/>
</grant-to>
</policy>
</cross-domain-access>
</access-policy>
This is my crossdomain.xml file
<?xml version="1.0" encoding="utf-8"?>
<access-policy>
<cross-domain-access>
<policy>
<allow-from http-request-headers="SOAPAction">
<domain uri="*"/>
</allow-from>
<grant-to>
<resource path="/" include-subpaths="true"/>
</grant-to>
</policy>
</cross-domain-access>
</access-policy>
Please help me, I have googled for two weeks now and tried the examples I
found, but nothing have helped.
Please I need HELP
Fia
|
|
|
|
|
You are publishing to an IIS server, correct?
Is the server you are publishing to configured for Silverlight[^]?
Is the endpoint address in your ServiceReferences.ClientConfig correct?
Can you connect to the service with the WCF Test Client[^] ?
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hi thanks for your answer.
Yes I think they are using IIS 5, as web development helper says.
I don't know if the server we are hosting to are configured for Silverlight.
I think the endpointadress is right. It has the adress where the service.svc is placed.
http://website.teliaweb.se/service.svc
No I can not connect to the service with WcfTestClient.exe. I get this error messages.
Failed to add a service. Service metadata may not be accessible. Make sure your service is running and exposing metadata.
and
Error: Cannot obtain Metadata from http://website.teliaweb.se/service.svc If this is a Windows (R) Communication Foundation service to which you have access, please check that you have enabled metadata publishing at the specified address. For help enabling metadata publishing, please refer to the MSDN documentation at http://go.microsoft.com/fwlink/?LinkId=65455.WS-Metadata Exchange Error URI: http://website.teliaweb.se/service.svc Metadata has a reference which can't be read. http://website.teliaweb.se/service.svc. The remote server returned an unexpected answer: (405) Method not allowed. The remote server returned an error: (405) Method not allowed.HTTP GET Error URI: http://website.teliaweb.se/service.svc Couldn't define the document type at URL:en http://website.teliaweb.se/service.svc as a known documenttype.The error message from every known type can help you find the solution for this problemt:- Rapport fr†n DISCO-dokument „r The name can't start with the sign %, hexadecimalt value 0x25. Rad 1, position 2..- Rapport from WSDL-dokument „r ther is an error in the XML-document (1, 2).. - The name can't start with the sign %, hexadecimalt value 0x25. Rad 1, position 2.- Rapport from XML-schema „r The name can't start with the sign %, hexadecimalt v„rde 0x25. Rad 1, position 2..
I have tried to translate the error message to english, hope you understand. Hope also this can help you to help me further.
Thanks
Fia
|
|
|
|
|
fiaolle wrote: Couldn't define the document type at URL:en http://website.teliaweb.se/service.svc as a known documenttype.
It looks like IIS isn't configured right to host the WCF service.
Are you able to get the Silverlight app or is an error returned there too?
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hi
I can run the silverlight application but when I'm using the wcf service I'm getting the error, nothing happens. I can see in the web development helper that the clientaccesspolicy.xml isn't reached. And the clientaccesspolicy.xml is placed in the root.
Fia
|
|
|
|
|
fiaolle wrote: when I'm using the wcf service I'm getting the error
Thanks. It wasn't clear (to me) when you were getting the error.
fiaolle wrote: the clientaccesspolicy.xml isn't reached. And the clientaccesspolicy.xml is placed in the root
I don't see anything indicating a cross-domain issue so I believe
that's irrelevant at the moment.
I don't think your WCF service is starting.
I've never used IIS 5 for WCF (or ASP.NET) so I'm no help with configuration.
Maybe Adam's link will help.
The error indicates a problem at the time the .SVC file is used, and since your
WCF service runs fine on your local IIS server, I don't think there's a problem there.
That's why I think there's an IIS configuration issue on the target machine.
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|