Framework version used: 2013.2.1210.0
so we have a class that inherits from the RadColorPicker as per below
which we use to get to the VisualColourPicker.SelectedColor property to find the ...well the selected colour.
This however throws an error at the moment with an Element Not found exception using the FindExpression [name 'Exact' LeftButton]
using snoop I have determined that the button that is in fact trying to be located is called "ButtonPart". So i have written my Property code as follows to get around this on my class I mentioned above...
so we have a class that inherits from the RadColorPicker as per below
public
class
VisualColourPicker : RadColorPicker
{
}
This however throws an error at the moment with an Element Not found exception using the FindExpression [name 'Exact' LeftButton]
using snoop I have determined that the button that is in fact trying to be located is called "ButtonPart". So i have written my Property code as follows to get around this on my class I mentioned above...
This however now gives me. An error of "Unable to cast object of type 'ArtOfTest.WebAii.Controls.Xaml.Wpf.SolidColorBrush' to type 'ArtOfTest.WebAii.Silverlight.UI.Brush'." So I had to change my property code above to the following to get the selected colour.public
ArtOfTest.WebAii.Controls.Xaml.Wpf.Color CustomSelectedColor
{
get
{
var but =
this
.Find.ByName<ArtOfTest.WebAii.Controls.Xaml.Wpf.Button>(
"ButtonPart"
);
var rec = but.Find.ByType<ArtOfTest.WebAii.Silverlight.UI.Rectangle>();
return
(rec.Fill
as
ArtOfTest.WebAii.Silverlight.UI.SolidColorBrush).Color;
}
}
Is there a reason why 1: simply VisualColourPicker.SelectedColor does not work out of the box in that its looking for some "LeftButton"var but =
this
.Find.ByName<ArtOfTest.WebAii.Controls.Xaml.Wpf.Button>(
"ButtonPart"
);
var rec = but.Find.ByType<ArtOfTest.WebAii.Silverlight.UI.Rectangle>();
var fill = (ArtOfTest.WebAii.Controls.Xaml.Wpf.SolidColorBrush)rec.GetProperty(
new
ArtOfTest.WebAii.Silverlight.AutomationProperty(
"Fill"
,
typeof
(ArtOfTest.WebAii.Controls.Xaml.Wpf.SolidColorBrush)));
return
fill.Color;
2: When I try and get the colour with myown property that the out of box Fill property then fails in an internal cast. Thanks