I have a 3rd party control (Visifire) which has a namespace that uses the "." format. This works fine in a WPF application, but not in a UserControl as it generates a "can't find assembly" if you try to include the namespace. This means I have to use code to add the control, set up the bindings, etc, etc, which is quite annoying as I would prefer to use XAML. My thought was to trick the UserControl using the following:
namespace MyControl
{
public class MyChart : Visifire.Charts.Chart
{
public MyChart () 开发者_如何学Go: base() {}
}
public partial Chart : UserControl
{
// All the control stuff goes here
}
}
Then, in XAML, I would use:
xmlns:local="clr-namespace:MyControl"
<Grid>
<local:MyChart>
</local:MyChart>
</Grid>
This doesn't seem to work, as it generates an exception. Anybody have any tips on how I could get around this? THanks much!
You can use:
<Grid xmlns:charts="clr-namespace:Visifire.Charts;assembly=Visifire">
<charts:Chart>...</charts:Chart>
</Grid>
To import a fully-qualified namespace, does that not work for you?
精彩评论