Ok so I've added this code for Binding Color converter inside Application.Resources in App.xaml:
xmlns:converter="clr-namespace:FtpUploader2.Converters"
<converter:MessageTypeEnumToColor x:Key="MessageTypeEnumToColor"/>
I get no error messages and the program compiles just fine and it changes the different colors on my message element until I added the PrintMessage() function at a line in my code.
<Label Content="{Binding Text}"
Background="{Binding MessageType, Converter={StaticResource MessageTypeEnumToColor}}"/>
Print message to wpf viewlist:
public void PrintMessage(string a_message, Model.Message.MsgType a_msgType = Model.Message.MsgType.Information)
{
Model.Message message = new Model.Message(a_message, a_msgType);
Messages.Insert(0, message);
}
I've used the PrintMessage funtion just fine many times in the application. Now comes the part I can't figure out why it happens.
In a function called HandleUploadTabSelected()
PrintMessage("Failed to upload one or more accounts", Model.Message.MsgType.Error);
causes the error message in title:
Error 1 The tag 'MessageTypeEnumToColor' does not exist in XML namespace 'clr-namespace:FtpUploader2.Converters'. Line 7 Position 10.
Now the weird part for me comes when I shorten the text to for example:
PrintMessage("Failed to upload", Model.Message.MsgType.Error);
it compiles and works ... :) I can't figure out what is wrong since it works and then doesn't based on the string input.
No comments:
Post a Comment