Search code examples
c#propertiesgetseteyeshot

View Cube - user specified labels


I want to change the View Cube labels in the Eyeshot model.

E.g. The user should be able to change the "S" direction to just what pleases the user.

What I have done

In the xaml I have accessed the "FrontRingLabel" and then bind it to "FrontRingUserInput" which should be a char.

<ddes:Viewport.ViewCubeIcon>
<ddes:ViewCubeIcon Lighting="False" ShowRing="True" FrontRingLabel="{Binding FrontRingUserInput}" />
</ddes:Viewport.ViewCubeIcon>

Then I try to set the value which i want to display:

public char FrontRingUserInput
{
   get { return 'south'; }

   set { }

}

The error CS1012 C# Too many characters in character literal

Any ideas, or alternativ solutions in how to set the view cube labels?


Solution

  • Well you are saying your property returns char which is of 1 byte but you are actually trying to return a string

    public char FrontRingUserInput
    {
       get { return 'south'; } // "south" is not 1 byte and thus is not char. So the error
    

    You probably want to change the type of the property to string

    public string FrontRingUserInput
    {
       get { return "south"; }