private BorderBox CreateCallButton(DiscountDetailContentUI parentContentUI, string bindingProperty)
            {
                int btnHeight = Device.OnPlatform(50, 50, 64);

                var imgPhone = new Image
                {
                    Source = parentContentUI.IconPhone,
                    HeightRequest = btnHeight / 1.5,
                    WidthRequest = btnHeight / 1.5
                };

                var txtPhone = new Label
                {
                    HorizontalOptions = LayoutOptions.CenterAndExpand,
                    VerticalOptions = LayoutOptions.CenterAndExpand,
                    Style = (Style)App.Current.Resources[LabelStyles.DetailPhoneStyle]
                };
                txtPhone.SetBinding(Label.TextProperty, bindingProperty);

                AbsoluteLayout phoneLayout = new AbsoluteLayout
                {
                    BackgroundColor = (Color)App.Current.Resources[MainStyles.MainLightBackgroundColor]
                };

                AbsoluteLayout.SetLayoutFlags(imgPhone, AbsoluteLayoutFlags.PositionProportional);
                AbsoluteLayout.SetLayoutBounds(imgPhone,
                    new Rectangle(0.1, 0.5, AbsoluteLayout.AutoSize, AbsoluteLayout.AutoSize)
                );

                AbsoluteLayout.SetLayoutFlags(txtPhone, AbsoluteLayoutFlags.PositionProportional);
                AbsoluteLayout.SetLayoutBounds(
                    txtPhone,
                    new Rectangle(
                        0.7, 				        // X
                        0.5, 				        // Y
                        AbsoluteLayout.AutoSize, 	// Width
                        AbsoluteLayout.AutoSize)	// Height
                );

                phoneLayout.Children.Add(imgPhone);
                phoneLayout.Children.Add(txtPhone);

                var borderPhone = new BorderBox();
                borderPhone.HeightRequest = btnHeight - 8;
                borderPhone.BorderWidth = 1;
                borderPhone.BorderColor = (Color)App.Current.Resources[MainStyles.MainBackgroundColor];
                borderPhone.Content = phoneLayout;

                return borderPhone;
            }
            public BranchInfoViewTemplate(ListView parentListView, DiscountDetailContentUI parentContentUI, DiscountDetailViewModel parentViewModel)
            {
                IsHighlightSelection = false;

                var stackBranch = new StackLayout
                {
                    Padding = new Thickness(18, 0),
                    VerticalOptions = LayoutOptions.FillAndExpand
                };

                #region Location
                Grid gridLocation = new Grid
                {
                    
                    RowDefinitions = 
                    {
                        new RowDefinition { Height = GridLength.Auto }
                    },
                    ColumnDefinitions = 
                    {
                        new ColumnDefinition { Width = GridLength.Auto },
                        new ColumnDefinition { Width = GridLength.Auto },
                        new ColumnDefinition  { Width = new GridLength(1, GridUnitType.Star) }
                    }
                };

                var txtDistanceValue = new Label
                {
                    VerticalOptions = LayoutOptions.Center,
                    HorizontalOptions = LayoutOptions.Start,
                    Style = (Style)App.Current.Resources[LabelStyles.DetailDistanceStyle]
                };
                txtDistanceValue.SetBinding(Label.TextProperty, "Distance");

                var distanceLabel = new StackLayout
                {
                    VerticalOptions = LayoutOptions.Center,
                    Spacing = 0,
                    Children =
                    {
                        new Image 
                        {
                            Source = parentContentUI.ImgDistance
                        },
                        new Label 
                        {
                            Text = parentContentUI.TxtDistanceScaleValue, 
                            Style = (Style)App.Current.Resources[LabelStyles.DescriptionStyle]
                        }
                    }
                };

                gridLocation.Children.Add(txtDistanceValue, 0, 0);
                gridLocation.Children.Add(distanceLabel, 1, 0);

                var txtPartnerAddress = new Label
                {
                    VerticalOptions = LayoutOptions.CenterAndExpand,
                    Style = (Style)App.Current.Resources[LabelStyles.DescriptionStyle]
                };
                txtPartnerAddress.SetBinding(Label.TextProperty, "Address");

                var txtShowOnMap = new LabelExtended
                {
                    Text = parentContentUI.TxtShowOnMap,
                    Style = (Style)App.Current.Resources[LabelStyles.LinkStyle],
                    IsUnderline = true
                };

                var locationLayout = new StackLayout
                {
                    VerticalOptions = LayoutOptions.Center,
                    Spacing = 0,
                    Children =
                    {
                        txtPartnerAddress,
                        txtShowOnMap
                    }
                };
                
                var viewGesturesShowOnMap = new ViewGestures
                {
                    Content = locationLayout,
                    DeformationValue = -5,
                };
                viewGesturesShowOnMap.BackgroundColor = (Color)App.Current.Resources[MainStyles.MainLightBackgroundColor];
                viewGesturesShowOnMap.Tap += parentViewModel.ShowOnMap_Click;
                viewGesturesShowOnMap.SetBinding(ViewGestures.TagProperty, "DocumentId");

                gridLocation.Children.Add(viewGesturesShowOnMap, 2, 0);

                stackBranch.Children.Add(gridLocation);

                #endregion

                #region Phone list
                var stackPhoneView = new StackLayout
                {
                    Padding = Device.OnPlatform(new Thickness(0, 4), new Thickness(0, 4), new Thickness(0, 4, -8, 4)),
                };

                #region phone1
                var phone1 = CreateCallButton(parentContentUI, "Phone1");
                phone1.SetBinding(BorderBox.TagProperty, "Phone1");

                var viewGesturesPhone1 = new ViewGestures
                {
                    Content = phone1,
                    DeformationValue = -5,
                };
                viewGesturesPhone1.SetBinding(ViewGestures.IsVisibleProperty, "IsPhone1FillIn");
                viewGesturesPhone1.BackgroundColor = (Color)App.Current.Resources[MainStyles.MainLightBackgroundColor];
                viewGesturesPhone1.Tap += parentViewModel.BtnCall_Click;
                stackPhoneView.Children.Add(viewGesturesPhone1);
                #endregion

                #region phone2
                var phone2 = CreateCallButton(parentContentUI, "Phone2");
                phone2.SetBinding(BorderBox.TagProperty, "Phone2");

                var viewGesturesPhone2 = new ViewGestures
                {
                    Content = phone2,
                    DeformationValue = -5,
                };
                viewGesturesPhone2.SetBinding(ViewGestures.IsVisibleProperty, "IsPhone2FillIn");
                viewGesturesPhone2.BackgroundColor = (Color)App.Current.Resources[MainStyles.MainLightBackgroundColor];
                viewGesturesPhone2.Tap += parentViewModel.BtnCall_Click;
                stackPhoneView.Children.Add(viewGesturesPhone2);
                #endregion

                stackBranch.Children.Add(stackPhoneView);
                #endregion
                
                View = stackBranch;
            }