I am able to create and run boo console applications in Sharpdevelop.
Is there a way to specify the UI using XAML markup and write the code behind in boo for WPF development in Sharpdevelop? If not is there any other alternative for WPF development in boo?
The build option 'Page' for XAML requires that the XamlMarkupCompiler (included with MSBuild) outputs code in the project's language. That's only supported for C# and VB.
However, you could use the build option 'EmbeddedResource' and then parse the .xaml at runtime using XamlLoader.
Here's an example implementation, extracted from
http://devpinoy.org/blogs/smash/archive/2006/10/04/XAMl-meets-Boo.aspx (down)
import System
import System.Windows
import System.Windows.Markup
import System.Windows.Controls
import System.Windows.Controls.Primitives
import System.IO
import System.Xml
class XamlPanel:
"""Parses a xaml file, returning a Panel, offering node lookup with .Get(NodeName)"""
[Property(Panel)]
private _panel as Panel
public def constructor(filename as string):
# parse the element tree via the XamlReader
streamReader = StreamReader(filename)
xmlreader = XmlReader.Create(streamReader)
_panel = XamlReader.Load(xmlreader)
public def Get(nodeName as string):
return LogicalTreeHelper.FindLogicalNode(_panel, nodeName)
(Cached) http://webcache.googleusercontent.com/search?q=cache:B2aZX6wcJPoJ:devpinoy.org/blogs/smash/archive/2006/10/04/XAMl-meets-Boo.aspx+xaml+and+boo&cd=1&hl=en&ct=clnk&gl=ca&source=www.google.ca
Related
I'm developing an Universal App for Win8.1, i've added the Winrt Xaml Toolkit dll but when i use Calendar control the strings of months appear only in English.
Is there any way to change them? I'm going crazy :D
PS: I've downloaded the source code of dll but there is no track of these strings
If you look at the DateTimeHelper class, you can see the method GetCurrentDateFormat which uses the en-US format. This method is used in many places for the Calendar and CalendarItem controls from the toolkit.
You can try to import the project from the site instead of using the NuGet package and then change this method to use your device locale. You can maybe change it to something like this:
public static DateTimeFormatInfo GetCurrentDateFormat()
{
return CultureInfo.CurrentCulture.DateTimeFormat;
}
I haven't tested this code so this is just a hint where you should look for your solution.
I have created a visual studio extension and bound behaviour to build events. I want it to load automatically when the user loads a solution. How do I do that?
You need to use the attribute ProvideAutoLoadAttribute on your class that inherits from Package and pass it the guid that represents UI context where a solution is loaded:
[PackageRegistration(UseManagedResourcesOnly = true)]
// This attribute is used to register the information needed to show this package
// in the Help/About dialog of Visual Studio.
[InstalledProductRegistration("#110", "#112", "1.0", IconResourceID = 400)]
[Guid(GuidList.guidHookIntoBuildEventsPkgString)]
[ProvideAutoLoadAttribute("{F1536EF8-92EC-443C-9ED7-FDADF150DA82}")]
public sealed class HookIntoBuildEventsPackage : Package
{
...
}
More UI contexts can be found here:
http://sandrinodimattia.net/blog/posts/some-clarity-on-auto-loading-visual-studio-2010-extensions/
I have created a PyGTK LinkButton on Windows. It contains a URI that I want to open in the user's browser.
gtk.LinkButton("http://www.mysite.com")
The documentation here suggests I need to provide a hook function to gtk.link_button_set_uri_hook. Is there a function built in to PyGTK that I can use cross-platform, or do I need to write my own Windows-specific function?
What have you tried? You don't have to supply an URI hook. Just provide the URI and the LinkButton will take care of the rest. Minimal example:
from gi.repository import Gtk
w = Gtk.Window()
w.connect("destroy", Gtk.main_quit)
w.add(Gtk.LinkButton("http://google.com", "test"))
w.show_all()
Gtk.main()
This creates a window with a single button that when clicked opens Google in the systems default web browser.
If for any reason this doesn't work, you can have a look at the webbrowser module in the Python standard library which provides cross-platform support (I don't know if this module is used in gtk internally as well, in this case it just wouldn't make a difference).
one method which is working for me, on both Windows and Linux:
def _open_link(func, data=None):
desktop.open(data)
gtk.link_button_set_uri_hook(_open_link)
I have a WP7 app that calls a WP7 client library. I added a new class to the client library then I go over to Blend to create sample data for the class. The dialog box to select the class to generate the sample data doesn't show the class or its namespace. Why not?
The class doesn't have an interface or generics and it is public.
I closed/reopened blend. Built the project in VS. What else should I check?
The client library has other namespaces and classes that Blend sample data generation dialog box does find.
Make sure your project is compiled after adding the class files. In Blend, select Project | Build Project from the menu (or CTRL+SHIFT+B).
I'm trying to upgrade some Sharepoint 2007 webparts to SP2010 using the web part projects built into Visual Studio 2010. Namely, I'm using Visual Web Part to migrate our existing controls, which make extensive use of ObjectDataSource. However, when adding an ODS to the control in the Visual Web Part project, it will not pick up objects in referenced class library projects. I was able to duplicate the problem from a clean setup as follows:
Create a new Visual Web Part
Add a new class library to the solution.
Class code is as follows:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace WebPartODS
{
[System.ComponentModel.DataObject(true)]
public class TestUser
{
[System.ComponentModel.DataObjectMethod(System.ComponentModel.DataObjectMethodType.Select,false)]
public List<int> TestMethod()
{
return new List<int>();
}
}
}
Add the class library project as a reference in the Web Part project
In the VisualWebPart ascx file, add a objectdatasource in the Source view:
<asp:ObjectDataSource ID="TestOD" runat="server"></asp:ObjectDataSource>
Switch to Design view, bring up the "Configure data source" wizard. On the drop down, the class from the library project will not appear.
Is there a step that I am missing here, or is there an issue with trying to do it this way?
Ok, i got it to work. Here is where i got my answer: MSDN Forumn
I originally had a separate class for my business layer. I removed it and put my code in the ascx.cs file. Then I added the following line of code to my page load method.
ObjectDataSource1.TypeName = this.GetType().AssemblyQualifiedName;
I also removed the TypeName from the ascx page.