WPF: Trying to add a class to Window.Resources Again -
i did same thing, still same error occurring: "the tag 'centertooltipconverter' not exist in xml namespace 'clr-namespace:wpfapplication1;assembly=wpfapplication1'. line 12 position 10."
centertooltipconverter.cs
namespace wpfapplication1 { public class centertooltipconverter : imultivalueconverter { public object convert(object[] values, type targettype, object parameter, cultureinfo culture) { if (values.firstordefault(v => v == dependencyproperty.unsetvalue) != null) { return double.nan; } double placementtargetwidth = (double)values[0]; double tooltipwidth = (double)values[1]; return (placementtargetwidth / 2.0) - (tooltipwidth / 2.0); } public object[] convertback(object value, type[] targettypes, object parameter, cultureinfo culture) { throw new notsupportedexception(); } } } mainwindow.xaml
<window x:class="wpfapplication1.mainwindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="clr-namespace:wpfapplication1;assembly=wpfapplication1" title="mainwindow" height="350" width="525"> <window.resources> <local:centertooltipconverter x:key="mycentertooltipconverter"/> </window.resources> </window> what doing wrong? in advance!!!
remove assembly part if referring same assembly.
xmlns:local="clr-namespace:wpfapplication1" or
xmlns:custom="clr-namespace:wpfapplication1;assembly=" from msdn : assembly can omitted if clr-namespace referenced being defined within same assembly application code referencing custom classes. or, equivalent syntax case specify assembly=, no string token following equals sign.
i hope help.
Comments
Post a Comment