I want to run this program
This is my app.xamlps://i.stack.imgur.com/HXWct.png
How can I solve the problem?
Maybe your StartupUri in App.xaml should look more like Data_binding/HelloBoundWorldSample.xaml ?
Related
I want to edit the ascx file for the pagingcontrol because it appears like this:
paging control
Notice the "Page 1 of 4" and the "First..." sticks together, and it is really annoying to look at. But when i tried to look for the pagingcontrol file to try to edit it, I cannot find it anywhere.
I read somewhere that there is supposed to be a pagingcontrols file in the controls folder but it is not there for me.
How can i edit the pagingcontrol file?
Thanks.
I would recommend using CsS to style this. Changes to the default controls is a breaking change and would be lost with an upgrade.
I have a file for applying styles to all controls ApplicationTheme.xaml and images in Images folder.
The build action is set to resource and copy to output directory always.
<Application.Resources>
<ResourceDictionary Source="Theme/ApplicationTheme.xaml"/>
</Application.Resources>
Now similarly i give the image source in the application theme file
ImageSource="Images\SGL-BG.jpg"
However i am getting error message
"'Failed to create a 'ImageSource' from the text 'Images\\SGL-BG.jpg'.'
What am i doing wrong here ? This is the approach i see mentioned on websites. Also if i give the full path it works. It fails to detect the theme file as well when i give Theme/ApplicationTheme.xaml. I am a WPF noob and i am not able to find solution to this seemingly simple issue.
Try this:
Source="/MyProject;component/Images/SGL-BG.jpg"
I'm attempting to use a resx file to localize some strings I am using in a XAML file. I've looked around at other documentation on the web, and they all seem to recommend a two part process:
Add a clr-namespace to your window, like this:
xmlns:props="clr-namespace:PJConfiguration.Properties"
Use that namespace to localize your string like this:
Content="{x:Static props:Resources.SharedSettings}"
I've done this, and also made sure that my resource classes are public, but I still get the following error from the XAML in step 2:
Cannot find the type 'Resources'.
Does anyone know what else might be causing this problem? Thanks in advance.
In order to make the Resources visible to XAML, you have to make sure that the code generation mode for the resources is set to public. In VS, you find that setting in a ComboBox near the top of the Resources designer window.
For more information on using .Net resources in XAML, you might want to refer to these blog posts: http://wpfglue.wordpress.com/category/localization/
Check if your .resx file is the default Resources.resx file inside the Properties directory of the Application assembly. If that is, there is no reason XAML couldn't find the public class Resources from the correct namespace under local assembly.
Try to specify the assembly name in Step 2 as recommended in this answer.
I am sure this is a trivial problem, but it's one of which I cannot seem to solve.
I changed the startup file in my App.xaml from StartupUri="MainWindow.xaml" to the code below, hoping that this all I needed to do.
<Application x:Class="MVVMPrototype.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
StartupUri="MVVMPrototype.View.MVVMPrototype.xaml">
<Application.Resources>
</Application.Resources>
However, I then got the following error stating that I need to set the build property to resource as show below. Previously it was set to Page, which is the same as what the MainWindow.xaml was set to.
After doing that I then have a compiler error stating that InitializeComponent(); does not exists in the current context. The only time I know this to happen is when the class / namespace is out of sync between the .cs file and the .xaml file, but this is not the case.
I have had a look at the StartupUri documentation but I have not found it to be that helpful. I am sure it is something silly I have overlooked. And yes, I have clean and built the project several times with no luck. Does anyone know how to solve it?
UPDATE: Seva Titov has solved the first part. But now I have a TargetInvocationException with an inner exception of System.Security.SecurityException with the picture below (open the image in a new tab if it's too hard to read):
Any ideas for this one?
StartupUri specifies relative file location, and you seem to have a file MVVMPrototype.xaml in folder View, so your code should look like this:
<Application x:Class="MVVMPrototype.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
StartupUri="View/MVVMPrototype.xaml">
Okay, I have now figured out what is happening.
As pointed out in the answer by Seva Titov the StartupUri should have the value of "View/MVVMPrototype.xaml".
The InitializeComponent(); error where it was stating it was not defined in the current context was because of the build action on the properties of MVVMPrototype.xaml was set to resource, not page. Originally I thought adding a new Window control solved this, but it turns out to be a red herring since the build action was set as page on the new control - I think that is the default.
The last error with the TargetInvocationException and the inner exception of System.Security.SecurityException I fixed by toggling the "Enable ClickOnce security settings" under Project Properties -> Security to generate the app.manifest.
This gave me the final error that it is unable to find the manifest signing certificate, so I just unchecked the "Sign the ClickOnce manifests" under project properties -> Signing.
This solved my issue. Hope it helps someone else. Please note I have little, if any, knowledge of deployment / publishing, and I am not sure how the last two will effect this.
in the App.xaml
StartupUri="/ProjectName;component/Folder Or Path/File Or Page.xaml">
I'm trying to increase the length of time that a tooltip displays in a silverlight application. I downloaded Silverlight.Controls.ToolTip from codeplex and I add it as a reference. Here is my code in my xaml:
xmlns:Controls="clr-namespace:Silverlight.Controls.ToolTips;assembly=Silverlight.Controls.ToolTips"
<Button Content="button content">
<Controls:ToolTipService.ToolTip>
<Controls:ToolTip DisplayTime="00:00:10" InitialDelay="00:00:03">
<TextBlock Text="tooltip"></TextBlock>
</Controls:ToolTip>
</Controls:ToolTipService.ToolTip>
</Button>
The code compiles. However, while running the code I get an error "XamlParseException occurred The attachable property 'ToolTip' was not found in 'ToolTipService.' Any ideas on what is causing this error? Thanks!
I had the same problem, here is how I solved it.
1) Go to: http://tooltipservice.codeplex.com/SourceControl/BrowseLatest
2) Download the Source Code
3) Copy "ToolTip.cs", "ToolTipService.cs" and ToolTipTimer.cs from
"branches\2.2.0\Silverlight.Controls.ToolTips\" into your own project somewhere.
4) Now point the xmlns to assembly on your own project where you have copied the source file into.
So basically, just use the source file instead of the dll and it will work. This has worked for me, hope it works for you.
Good Luck.
If you are referencing the ToolTip DLL from another DLL, try also adding a reference to it into you main project.
You have downloaded this DLL from web and have not unblocked it yet.
Right Click on the DLL, go to properties and unblock it.