UWP Community Toolkit with source code - c#

"UWP Community Toolkit" is good tool.
https://github.com/Microsoft/UWPCommunityToolkit/tree/master
but If we installed it with NuGet,
We can not access source code ( I thought ).
Now, I only want to use "RadialGauge" only in this toolkit.
and I want to modify "RadialGauge" a bit..
then, I started to use RadialGauge with source code without NuGet install.
here is my step.
I open New UWP project with C# VS 2017.
I installed this code to my "Controls" folder. UWP RadialGauge Source
and I make this project.
but No display, Just white UWP windows is opened... Why ?
I need help... with my poor UWP knowledge, to resolve is not possible...
Here is project file.
https://www.dropbox.com/s/alvw6wcbiv5itsp/RadialGaugeTest.zip?dl=0

When you define a custom control, most of the time you want to give it a default style. This style needs to be placed inside a ResourceDictionary called Generic.xaml which then needs to be inside a folder called Themes.
In your case, you have only copied the code part over. To make the control show up on your page, all you need to do is go grab its default style from here, put it in a Generic.xaml resource dictionary, and then put the dictionary into a folder called Themes.

Related

Item Templates Sometimes Missing in Visual Studio 2017

Using Visual Studio 2017, sometimes new item templates are missing, and it seems to be tied to the particular project to which I'm trying to add an item.
Although both show up as "C#" projects...
...in "Logging", for WPF items, I have only UserControl (WPF) as an option:
However, in "SanityCheck", I have a much-more-full list of WPF options:
The only difference I can easily see so far is that the one ("Logging") is a Class Library project while the other ("SanityCheck") is a Windows Application project. However, changing Logging to Windows Application doesn't make more options available, and I ought to be able to create a Window in a Class Library, right?
I also noticed that Logging didn't contain all the same references as SanityCheck, so I added all the ones that seemed possibly-related, and that also didn't make any difference in the set of templates available.
So how do I get my Logging project to let me add a WPF Window?
Thanks to a comment from ASh and the list referred to from this question, I determined that the cause was a missing <ProjectTypeGuids> block in the Logging.csproj file. I copied the one from the SanityCheck.csproj file and now all the C# WPF templates are available. So far I haven't encountered any negative side-effects to this solution. Time will tell.

Page does not exist build error in xamarin

I have done a fresh install of VS2015 Community with Xamarin. I created a xaml page in the portable project. Then I see the most common error people have been cribbing about, InitializeComponent does not exist in the current context. A lot of solutions have been suggest by people.
Finally what worked was changing the build property of my Hellopage.cs to Embedded resource. But once that is done in the App.cs where you set the Mainpage, I see red squiggly lines which say that my Hellopage does not exist?
This is how I'm trying to set the mainpage.
MainPage = new Hellopage();
Anything that I'm missing?
Worked Solution Link
I've had this problem before and the reason was that the XAML files weren't processed correctly. What you should try is this:
In the properties pane of Hellopage.xaml, see Custom Tools
Change the value to MSBuild:Compile or something else
Click around to make sure Visual Studio processes the change
Change the value back to MSBuild: UpdateDesignTimeXaml
Another thing you can try is open the xaml and xaml.cs files and save them.

WPF Project with Custom XAML Controls

I am new to WPF coding. I have a project that has custom controls coded as xaml's with C# code-behinds. I try to import these files into another project and when I try to use these xaml controls in my main view file, Visual Studio cannot find the namespace that the imported xaml's and C# code-behinds are attached to.
I tried changing the namespace to be the same as my current project. I tried restarting Visual Studio 2013. Neither of these worked.
I tried adding the project with the custom controls to my solution. The imported project can read the custom xaml's, but my main project still can't reference them. I tried dragging the files over to the main project, and they still won't work.
I tried rebuilding the controls xaml's and C# code-behinds in my new project it still says:
The type 'local:ClickSelectTextBox' was not found. Please verify that that you are not missing an assembly reference and that all reference assemblies have been built.
This item is under the appropriate namespace and in the current project.
In visual studio go to TOOLS -> choose Toolbox Items. this will allow you either choose from an array of different components or browse around to find a dll that you would like to use.
EDIT:
Oh so you are trying to take customized xaml files that you already have written and modify them in a separate project? I would suggest one of two things.
1: right click your project name -> add existing, and add the xaml and xaml.cs file to your project at the same time.
if for some reason that does not work you can also try
2: creating a new xaml control (with the same name of the control you want to drop in) in your project and copy pasting the xaml code into that control, this should autogenerate the codebehind designer shell you are going to need. you can then go into the xaml.cs file and drop whatever business logic you are looking for. It is not the cleanest solution but sometimes the WPF editor gets a little funky when importing xaml files
I know it's an old post but still somebody may find it useful:) So! ... Make sure
1)You don't have public class outside of root namespace, check this
link
2)You are not mixing targets of your assemblies (unless you can't 100% avoid that)
For example, if you are referencing something like SQLite.Core NuGet (that has both x86 and x64 versions of SQLite.Interop.dll built in) in a project that is AnyCPU, sometimes it's easier to set application's target to x86 or x64 to solve the x86/x64 paths issues - but then you may get all these "type not found/control not built/assembly not found" and all that sorts of nonsense from Designer even despite your app builds and runs ok.
Hope that helps
Try downloading ReSharper's trial version, install it and then open up your code again. One of the awesome features Resharper has with XAML code is that it will automatically map objects to their appropriate namespace. I think this will make it easier for you and will show you a ton of ways to do things better. When I was first learning WPF it was honestly a godsend to use Resharper.

How to build library with WPF forms

Is it possible to build a Class Library dll which also includes WPF forms?
When I try to build one I get following errors:
Error 1 Library project file cannot specify ApplicationDefinition element.
Error 2 The project file contains a property value that is not valid.
If I set my project as Windows Application it compiles & runs tho. Is there a way to get arround this? I'm using VS2010 & C# .NET 4.0 if that might be of any interest to you guys.
Thanks
Choose WPF Custom Control Library or WPF User Control Library when creating/adding new project to your solution.
Change the build action of your UserControl from ApplicationDefinition to Page.
Remove the App.xaml and App.xaml.cs in your WPF Project. Then you will be able to run the project with an output type of Class Library.
This is also occur when we copy paste an Image to ClassLibrary Project.
Change the Build Action Property of that image to resources
Extending #2493490 answer.
Right click on the app.xaml file and exclude it from the project.
Change the project output type to in project properties to Class Library.
Click on the run icon, the solution will successfully build but will not run/execute any code. A error message will be displayed explaining as such.
problems after copying XAML controls from WPF Application to class library
The first answer work for me.
I changed App.xaml from ApplicationDefinition to Page and worked

adding images in my project

I'm trying to add/change images in my project, using Microsoft Visual Studio 2008 C#. Along with it, Devexpress components are also included.
What I did, I copied an image (.png file) and paste it it in my "PrintRibbonControllerResources.resx" and then after that I have to open again the MainForm.cs right click on the form and click on the Run Designer. It will open the Ribbon Control Designer. From there, I can add the image.
Do you think its ok? It's my first time to do this, and I don't have any experience & I'm learning it by doing.
Thanks
===
it seems I don't see the add function under resource tab
I generally add an image to the project itself. (Add/Existing item) I do this so I can use SourceControl to check in/out the image file. The resx then links to these files.
Basically, my philosophy is: if it works, don't fix it.
If this solution works for you, it's fine. At least, until you discover a situation where it fails.
If you go in the properties of your project, and select the resources tab, you can add it directly from there and it will be accessible in the default resource file of your project, which might be more convenient.
I like to add it to a solution folder (or folder in the project) and like that to the resx via "Add Exising File".
I get all of the advantages of having the resource file, but also the advantages of having a physical file (editing, quick view, etc.)

Categories

Resources