custom-renderer

Force redraw of Xamarin.Forms View with custom renderer

霸气de小男生 提交于 2019-12-03 11:19:06
I have a visual element MyButton with a custom renderer implemented for iOS. Shared: namespace RendererTest { public class MyButton: Button { public Color BoundaryColor { get; set; } } public static class App { public static Page GetMainPage() { var button = new MyButton { Text = "Click me!", BoundaryColor = Color.Red }; button.Clicked += (sender, e) => (sender as MyButton).BoundaryColor = Color.Blue; return new ContentPage { Content = button }; } } } iOS: [assembly:ExportRenderer(typeof(MyButton), typeof(MyButtonRenderer))] namespace RendererTest.iOS { public class MyButtonRenderer:

p:commandButton action and f:setpropertyactionlistener not invoked in p:columngroup

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-02 06:02:03
问题 I need to put child components in primefaces subtable footer (p:columngroup type="footer"), but standard subtable renderer doesn't provide such opportunity. So I have overrided org.primefaces.component.SubTableRenderer to add children rendering: public class CustomSubTableRenderer extends SubTableRenderer{ @Override protected void encodeColumnFooter(FacesContext context, SubTable table, Column column) throws IOException { ResponseWriter writer = context.getResponseWriter(); String style =

p:commandButton action and f:setpropertyactionlistener not invoked in p:columngroup

守給你的承諾、 提交于 2019-12-01 23:26:56
I need to put child components in primefaces subtable footer (p:columngroup type="footer"), but standard subtable renderer doesn't provide such opportunity. So I have overrided org.primefaces.component.SubTableRenderer to add children rendering: public class CustomSubTableRenderer extends SubTableRenderer{ @Override protected void encodeColumnFooter(FacesContext context, SubTable table, Column column) throws IOException { ResponseWriter writer = context.getResponseWriter(); String style = column.getStyle(); String styleClass = column.getStyleClass(); styleClass = styleClass == null ? DataTable

Custom JSF component: Using “startElement” with “script” results in a comment

非 Y 不嫁゛ 提交于 2019-12-01 13:20:18
I'm rendering a custom JSF component. In the method encodeBegin I want to include some java script. public void encodeBegin(FacesContext context) throws IOException { ResponseWriter writer = context.getResponseWriter(); writer.startElement("script", this); writer.writeAttribute("type", "text/javascript", null); writer.writeText("var width=400",null); writer.endElement("script"); } When rendering the component the content of the script tag is commented out. <script type="text/javascript"><!-- var width=400; //--></script> Can anybody explain why this comment appears and how I get rid of it?

Circled Label Xamarin Forms

China☆狼群 提交于 2019-12-01 11:28:45
问题 What I want to Achieve: A seen in the below screenshot there is a label with a hole number, I want to create a circle around this label,how would I go about achieving this? Now my assumption is that to achieve this I will need to create a custom renderer and override the Label class but from there I'm not sure how I would draw the circle and achieve the expected results. Any guidance and assistance would be greatly appreciated. 回答1: On the following link you will find the code and video for a

Xamarin.Forms 2.5.0 and Context

老子叫甜甜 提交于 2019-12-01 03:03:49
Today I updated to Xamarin.Forms 2.5.0 and saw, that I get the following warnings: From the Android sub-project: Warning CS0618 'Forms.Context' is obsolete: 'Context is obsolete as of version 2.5. Please use a local context instead.' How can I get the local context instead of Forms.Context ? Is the Android Context meant? From the custom renderer: Warning CS0618 'ButtonRenderer.ButtonRenderer()' is obsolete: 'This constructor is obsolete as of version 2.5. Please use ButtonRenderer(Context) instead.' In my ButtonRenderer I only have the OnElementChanged() method, so what should I change here?

Xamarin.Forms 2.5.0 and Context

流过昼夜 提交于 2019-11-30 22:31:58
问题 Today I updated to Xamarin.Forms 2.5.0 and saw, that I get the following warnings: From the Android sub-project: Warning CS0618 'Forms.Context' is obsolete: 'Context is obsolete as of version 2.5. Please use a local context instead.' How can I get the local context instead of Forms.Context ? Is the Android Context meant? From the custom renderer: Warning CS0618 'ButtonRenderer.ButtonRenderer()' is obsolete: 'This constructor is obsolete as of version 2.5. Please use ButtonRenderer(Context)

How can we handle the done button click event for a Xamarin Forms Picker?

喜你入骨 提交于 2019-11-29 11:30:32
I want to fire a click event on the Done button on a Picker in Xamarin Forms. I found some people having custom render for entry, but how can we implement the done button in a Picker on Xamarin forms iOS? You can use a custom renderer to achieve this. Looking at the source code for the Picker on iOS, you can see that the 'Done' button is added to a UIToolbar. You can get a reference to the button and then handle its 'Clicked' event: public class MyPickerRenderer : PickerRenderer { protected override void OnElementChanged(ElementChangedEventArgs<Picker> e) { base.OnElementChanged(e); if(e

How to make a progress bar with rounded corners in Xamarin Forms using Custom Renderer

雨燕双飞 提交于 2019-11-29 05:11:49
I want to display progress bar with rounded corners in Xamarin forms. I was able to do it in iOS using a custom renderer: class CustomProgressBarRenderer: ProgressBarRenderer { protected override void OnElementChanged(ElementChangedEventArgs<Xamarin.Forms.ProgressBar> e) { base.OnElementChanged(e); Control.ProgressTintColor = Color.FromRgb(255, 201, 74).ToUIColor(); } public override void LayoutSubviews() { base.LayoutSubviews(); var X = 1.0f; var Y = 7.0f; CGAffineTransform transform = CGAffineTransform.MakeScale(X, Y); this.Transform = transform; this.ClipsToBounds = true; this.Layer

How can we handle the done button click event for a Xamarin Forms Picker?

徘徊边缘 提交于 2019-11-28 05:07:54
问题 I want to fire a click event on the Done button on a Picker in Xamarin Forms. I found some people having custom render for entry, but how can we implement the done button in a Picker on Xamarin forms iOS? 回答1: You can use a custom renderer to achieve this. Looking at the source code for the Picker on iOS, you can see that the 'Done' button is added to a UIToolbar. You can get a reference to the button and then handle its 'Clicked' event: public class MyPickerRenderer : PickerRenderer {