This question is locked. New answers and comments are not allowed.
Hi,
I am assigning an image to imagebutton as RestStateImageSoure and setting Foreground color to Black. When I launch the App, it showing image in back color correctly. But when I press/hold the button, Image color is changing to white. How to change this behavior.
Thanks in advance
I am assigning an image to imagebutton as RestStateImageSoure and setting Foreground color to Black. When I launch the App, it showing image in back color correctly. But when I press/hold the button, Image color is changing to white. How to change this behavior.
Thanks in advance
4 Answers, 1 is accepted
0
Hi,
In this case you can redefine the PressedStateWithOpacityMaskForegroundFillBrush named brush that controls this behavior.
Let me know if this helps.
Regards,
Ivaylo Gergov
Telerik
In this case you can redefine the PressedStateWithOpacityMaskForegroundFillBrush named brush that controls this behavior.
Let me know if this helps.
Regards,
Ivaylo Gergov
Telerik
Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.
0

rajeev
Top achievements
Rank 1
answered on 12 May 2014, 04:09 PM
Hi Ivaylo Gergov,
Thanks for your reply.
Could you explain how to define this. I have tried but couldn't find anything like "PressedStateWithOpacityMaskForegroundFillBrush ".
My code in .xaml:
<tp:RadImageButton Background="{StaticResource PhoneColor}" x:Name="imgMobile" ButtonShape="Ellipse" ButtonType="Custom" RestStateImageSource="/Assets/Icons/Mobile_D.png" Foreground="Black" Width="150" Height="150" />
in MainPage.cs:
if (DeviceNetworkInformation.IsCellularDataEnabled)
{
imgMobile.RestStateImageSource = new BitmapImage(new Uri("/Assets/Icons/Mobile_E.png", UriKind.Relative));
imgMobile.Foreground = new SolidColorBrush(Colors.White);
}
else
{
imgMobile.RestStateImageSource = new BitmapImage(new Uri("/Assets/Icons/Mobile_D.png", UriKind.Relative));
imgMobile.DisabledStateImageSource = new BitmapImage(new Uri("/Assets/Icons/Mobile_D.png", UriKind.Relative));
imgMobile.Foreground = new SolidColorBrush(Colors.Black);
}
Where I need to implement your changes?
Thanks for your reply.
Could you explain how to define this. I have tried but couldn't find anything like "PressedStateWithOpacityMaskForegroundFillBrush ".
My code in .xaml:
<tp:RadImageButton Background="{StaticResource PhoneColor}" x:Name="imgMobile" ButtonShape="Ellipse" ButtonType="Custom" RestStateImageSource="/Assets/Icons/Mobile_D.png" Foreground="Black" Width="150" Height="150" />
in MainPage.cs:
if (DeviceNetworkInformation.IsCellularDataEnabled)
{
imgMobile.RestStateImageSource = new BitmapImage(new Uri("/Assets/Icons/Mobile_E.png", UriKind.Relative));
imgMobile.Foreground = new SolidColorBrush(Colors.White);
}
else
{
imgMobile.RestStateImageSource = new BitmapImage(new Uri("/Assets/Icons/Mobile_D.png", UriKind.Relative));
imgMobile.DisabledStateImageSource = new BitmapImage(new Uri("/Assets/Icons/Mobile_D.png", UriKind.Relative));
imgMobile.Foreground = new SolidColorBrush(Colors.Black);
}
Where I need to implement your changes?
0
Accepted
Hi,
You need to extract the template of the control by right-clicking it in Visual Studio's designer and choosing Edit Template -> Edit a Copy. This will extract the default style and you will be able to locate the PressedStateWithOpacityMaskForegroundFillBrush and change its value.
I hope this information helps.
Regards,
Todor
Telerik
You need to extract the template of the control by right-clicking it in Visual Studio's designer and choosing Edit Template -> Edit a Copy. This will extract the default style and you will be able to locate the PressedStateWithOpacityMaskForegroundFillBrush and change its value.
I hope this information helps.
Regards,
Todor
Telerik
Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.
0

rajeev
Top achievements
Rank 1
answered on 14 May 2014, 05:56 AM
Thanks Todor & Ivaylo Gergov
It solved my issue.
It solved my issue.