Guest User

Untitled

a guest
Jan 23rd, 2019
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.61 KB | None | 0 0
  1. <ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
  2. xmlns:controls="clr-namespace:App.CustomControls"
  3. xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
  4. xmlns:local="clr-namespace:app.CustomControls">
  5. <ContentPage.Content>
  6. <StackLayout Orientation="Vertical">
  7. <ContentView>
  8. <OnPlatform x:TypeArguments="View">
  9. <OnPlatform.Android>
  10. <local:CustomCalendarEvent/>
  11. </OnPlatform.Android>
  12. </OnPlatform>
  13. </ContentView>
  14. </StackLayout>
  15. </ContentPage.Content>
  16. </ContentPage>
  17.  
  18. public class CustomCalendarEvent : View{ }
  19.  
  20. [assembly: ExportRenderer(typeof(CustomCalendarEvent), typeof(CustomCalendarEventRenderer))]
  21. namespace App.Droid.CustomRenderers
  22. {
  23. public class CustomCalendarEventRenderer : ViewRenderer
  24. {
  25. protected override void OnElementChanged(ElementChangedEventArgs<Xamarin.Forms.View> e)
  26. {
  27. base.OnElementChanged(e);
  28. if (Control == null)
  29. {
  30. try
  31. {
  32. var intent = new Intent(Forms.Context, typeof(Events));
  33. Forms.Context.StartActivity(intent);
  34.  
  35. //var context = Xamarin.Forms.Forms.Context;
  36. //LayoutInflater inflater = context.GetSystemService(Context.LayoutInflaterService) as LayoutInflater;
  37. //var _view = inflater.Inflate(Resource.Layout.EventView, this, false);
  38. //mWeekView = _view.FindViewById<WeekView>(Resource.Id.weekView);
  39. //SetNativeControl(_view);
  40. }
  41. catch (Exception ex)
  42. {
  43. string Message = ex.Message;
  44. }
  45. }
  46. }
  47. }
  48.  
  49. public class Events : AppCompatActivity, WeekView.IEventClickListener, WeekView.IEventLongPressListener, MonthLoader.IMonthChangeListener
  50. {
  51. private SupportToolbar mToolbar;
  52.  
  53. private static int TYPE_DAY_VIEW = 1;
  54. private static int TYPE_THREE_DAY_VIEW = 2;
  55. private static int TYPE_WEEK_VIEW = 3;
  56. private int mWeekViewType = TYPE_THREE_DAY_VIEW;
  57. private WeekView mWeekView;
  58. protected override void OnCreate(Bundle bundle)
  59. {
  60. base.OnCreate(bundle);
  61.  
  62. // Set our view from the "main" layout resource
  63. SetContentView(Resource.Layout.EventView);
  64. ---
  65. ----------
  66. ---
  67. ----------
  68. ---
  69. ----------
  70.  
  71. }
  72. }
Add Comment
Please, Sign In to add comment