Forum General

Announcement:

The Xamarin Forums have officially moved to the new Microsoft Q&A experience. Microsoft Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

To create new threads and ask questions head over to Microsoft Q&A for .NET and get involved today.

How to control image with biding Data?

Hello?

Nice to meet all.

Now I start learn to xamarin. about 1 week.

I wanna control image. (on.png and Off.png) with Biding Data.

mySQL biding Item is SOL, SSR, DIO, RLY. and Value (0x00 ~ 0xFF)

C# ....

if (Item == "SOL")
{
switch (Value)
{
case 0: { if (Item.Value & 0x01) { return "SOL_On.png"; } else { return "SOL_Off.png"; } break; }
case 1: { if (Item.Value & 0x02) { return "SOL_On.png"; } else { return "SOL_Off.png"; } break; }
case 2: { if (Item.Value & 0x04) { return "SOL_On.png"; } else { return "SOL_Off.png"; } break; }
case 3: { if (Item.Value & 0x08) { return "SOL_On.png"; } else { return "SOL_Off.png"; } break; }
case 4: { if (Item.Value & 0x10) { return "SOL_On.png"; } else { return "SOL_Off.png"; } break; }
case 5: { if (Item.Value & 0x20) { return "SOL_On.png"; } else { return "SOL_Off.png"; } break; }
case 6: { if (Item.Value & 0x40) { return "SOL_On.png"; } else { return "SOL_Off.png"; } break; }
case 7: { if (Item.Value & 0x80) { return "SOL_On.png"; } else { return "SOL_Off.png"; } break; }
}
}
else if (Item == "SSR")
{
switch (Value)
{
case 0: { if (Item.Value & 0x01) { return "SSR_On.png"; } else { return "SSR_Off.png"; } break; }
case 1: { if (Item.Value & 0x02) { return "SSR_On.png"; } else { return "SSR_Off.png"; } break; }
case 2: { if (Item.Value & 0x04) { return "SSR_On.png"; } else { return "SSR_Off.png"; } break; }
case 3: { if (Item.Value & 0x08) { return "SSR_On.png"; } else { return "SSR_Off.png"; } break; }
case 4: { if (Item.Value & 0x10) { return "SSR_On.png"; } else { return "SSR_Off.png"; } break; }
case 5: { if (Item.Value & 0x20) { return "SSR_On.png"; } else { return "SSR_Off.png"; } break; }
case 6: { if (Item.Value & 0x40) { return "SSR_On.png"; } else { return "SSR_Off.png"; } break; }
case 7: { if (Item.Value & 0x80) { return "SSR_On.png"; } else { return "SSR_Off.png"; } break; }
}
}

XAML....

<===== This is just Fix image.

But I need <===== !!!!

example.:
ValueToImage(biding ITEM, biding Value, 0x01)

if (Item == "SOL")
{
switch (Value)
{
case 0: { if (Item.Value & 0x01) { return "SOL_On.png"; } else { return "SOL_Off.png"; } break; }
case 1: { if (Item.Value & 0x02) { return "SOL_On.png"; } else { return "SOL_Off.png"; } break; } <====!!!!!!

But I don't know how to make function.

please teach me... how to make it right function.

Thank you~

Answers

Sign In or Register to comment.