Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ protected override void OnApplyTemplate()
{
base.OnApplyTemplate();

_icon = (GetTemplateChild(ElementIcon) as View)!;
_icon = (View)GetTemplateChild(ElementIcon);
_icon.WidthRequest = Width;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public IndicatorCodeGallery()
generator.GenerateItems();

_carouselView.PropertyChanged += CarouselViewPropertyChanged;
(_carouselView.ItemsSource as ObservableCollection<CollectionViewGalleryTestItem>)!.CollectionChanged += IndicatorCodeGalleryCollectionChanged;
((ObservableCollection<CollectionViewGalleryTestItem>)_carouselView.ItemsSource).CollectionChanged += IndicatorCodeGalleryCollectionChanged;

var indicatorView = new IndicatorView
{
Expand Down Expand Up @@ -205,7 +205,7 @@ public IndicatorCodeGallery()
Padding = new Thickness(5),
Command = new Command(() =>
{
var items = (_carouselView.ItemsSource as ObservableCollection<CollectionViewGalleryTestItem>)!;
var items = (ObservableCollection<CollectionViewGalleryTestItem>)_carouselView.ItemsSource;
items.Remove(items[0]);
})
};
Expand Down Expand Up @@ -238,7 +238,7 @@ public IndicatorCodeGallery()
_carouselView.Position++;
}, () =>
{
var items = (_carouselView.ItemsSource as ObservableCollection<CollectionViewGalleryTestItem>)!;
var items = (ObservableCollection<CollectionViewGalleryTestItem>)_carouselView.ItemsSource;
return _carouselView.Position < items.Count - 1;
})
};
Expand All @@ -252,7 +252,7 @@ public IndicatorCodeGallery()
Padding = new Thickness(5),
Command = new Command(() =>
{
var items = (_carouselView.ItemsSource as ObservableCollection<CollectionViewGalleryTestItem>)!;
var items = (ObservableCollection<CollectionViewGalleryTestItem>)_carouselView.ItemsSource;
var indexToRemove = items.Count - 1;
items.Remove(items[indexToRemove]);
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public ItemsSourceGenerator(ItemsView cv, int initialItems = 1000,
button.Clicked += GenerateItems;
WeakReferenceMessenger.Default.Register<ExampleTemplateCarousel, string>(this, "remove", (_, obj) =>
{
(cv.ItemsSource as ObservableCollection<CollectionViewGalleryTestItem>)!.Remove((obj.BindingContext as CollectionViewGalleryTestItem)!);
((ObservableCollection<CollectionViewGalleryTestItem>)cv.ItemsSource).Remove((obj.BindingContext as CollectionViewGalleryTestItem)!);
});

Content = layout;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public ObservableCodeCollectionViewGallery(ItemsLayoutOrientation orientation =

IItemsLayout itemsLayout = grid
? new GridItemsLayout(3, orientation)
: new LinearItemsLayout(orientation) as IItemsLayout;
: new LinearItemsLayout(orientation);

var itemTemplate = ExampleTemplates.PhotoTemplate();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public ObservableCollectionResetGallery()
}
};

var itemsLayout = new GridItemsLayout(3, ItemsLayoutOrientation.Vertical) as IItemsLayout;
IItemsLayout itemsLayout = new GridItemsLayout(3, ItemsLayoutOrientation.Vertical);

var itemTemplate = ExampleTemplates.PhotoTemplate();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ public ObservableMultiItemCollectionViewGallery(ItemsLayoutOrientation orientati
}
};

var itemsLayout = grid
IItemsLayout itemsLayout = grid
? new GridItemsLayout(3, orientation)
: new LinearItemsLayout(orientation) as IItemsLayout;
: new LinearItemsLayout(orientation);

var itemTemplate = ExampleTemplates.PhotoTemplate();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ protected override async void OnAppearing()

void OnItemsUpdatingScrollModeChanged(object sender, EventArgs e)
{
CollectionView.ItemsUpdatingScrollMode = (ItemsUpdatingScrollMode)(sender! as EnumPicker)!.SelectedItem;
CollectionView.ItemsUpdatingScrollMode = (ItemsUpdatingScrollMode)((EnumPicker)sender!).SelectedItem;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ protected override void OnAppearing()

private void OnDragStarting(object sender, DragStartingEventArgs e)
{
var boxView = (View)(sender as Element)!.Parent;
var boxView = (View)((Element)sender)!.Parent;
DragStartingTitle.IsVisible = true;
DragStartingPositionLabel.Text = $"- Self X:{(int)e.GetPosition(boxView)!.Value.X}, Y:{(int)e.GetPosition(boxView)!.Value.Y}";
DragStartingScreenPositionLabel.Text = $"- Screen X:{(int)e.GetPosition(null)!.Value.X}, Y:{(int)e.GetPosition(null)!.Value.Y}";
Expand All @@ -54,7 +54,7 @@ private void OnDragStarting(object sender, DragStartingEventArgs e)

private void OnDropCompleted(object sender, DropCompletedEventArgs e)
{
var sl = (sender as Element)!.Parent as StackLayout;
var sl = ((Element)sender).Parent as StackLayout;

if (sl == SLAllColors)
SLRainbow.Background = SolidColorBrush.White;
Expand All @@ -65,7 +65,7 @@ private void OnDropCompleted(object sender, DropCompletedEventArgs e)

private void OnDragOver(object sender, DragEventArgs e)
{
var sl = (StackLayout)(sender as Element)!.Parent;
var sl = (StackLayout)((Element)sender).Parent;

if (!e.Data.Properties.ContainsKey("Source"))
return;
Expand All @@ -86,7 +86,7 @@ private void OnDragOver(object sender, DragEventArgs e)

private void OnDragLeave(object sender, DragEventArgs e)
{
var sl = (StackLayout)(sender as Element)!.Parent;
var sl = (StackLayout)((Element)sender).Parent;

if (!e.Data.Properties.ContainsKey("Source"))
return;
Expand All @@ -107,7 +107,7 @@ private void OnDragLeave(object sender, DragEventArgs e)

private void OnDrop(object sender, DropEventArgs e)
{
var sl = (sender as Element)!.Parent as StackLayout;
var sl = ((Element)sender).Parent as StackLayout;

if (!e.Data.Properties.ContainsKey("Source"))
return;
Expand All @@ -122,7 +122,7 @@ private void OnDrop(object sender, DropEventArgs e)
DropScreenPositionLabel.Text = $"- Screen: X:{(int)e.GetPosition(null)!.Value.X}, Y:{(int)e.GetPosition(null)!.Value.Y}";
DropRelativePositionLabel.Text = $"- This label: X:{(int)e.GetPosition(DropRelativePositionLabel)!.Value.X}, Y:{(int)e.GetPosition(DropRelativePositionLabel)!.Value.Y}";

var color = (e.Data.Properties["Color"] as SolidColorBrush)!;
var color = (SolidColorBrush)e.Data.Properties["Color"];

if (AllColors.Contains(color))
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ void SwapRoot(object sender, EventArgs e)
}
else
{
(Parent as IStackNavigationView)!.RequestNavigation(
((IStackNavigationView)Parent).RequestNavigation(
new NavigationRequest(_currentNavStack, true));

_currentNavStack = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public LargeTitlesPageiOS()
{
Text = "Tooggle UseLargeTitles on Navigation",
Command = new Command( () =>{
var navPage = (Parent as NavigationPage)!;
var navPage = (NavigationPage)Parent;
navPage.On<iOS>().SetPrefersLargeTitles(!navPage.On<iOS>().PrefersLargeTitles());
} )
},
Expand All @@ -54,7 +54,7 @@ public LargeTitlesPageiOS()
{
Text = "UseLargeTitles on Navigation with safe Area",
Command = new Command( () =>{
var navPage = (Parent as NavigationPage)!;
var navPage = (NavigationPage)Parent;
navPage.On<iOS>().SetPrefersLargeTitles(true);
var page = new ContentPage { Title = "New Title", BackgroundColor = Colors.Red };
page.On<iOS>().SetUseSafeArea(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public AndroidSwipeViewTransitionModePage()

void OnSwipeViewTransitionModeChanged(object sender, EventArgs e)
{
SwipeTransitionMode transitionMode = (SwipeTransitionMode)(sender as EnumPicker)!.SelectedItem;
SwipeTransitionMode transitionMode = (SwipeTransitionMode)((EnumPicker)sender).SelectedItem;
swipeView.On<Microsoft.Maui.Controls.PlatformConfiguration.Android>().SetSwipeTransitionMode(transitionMode);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ static void OnParentPagePropertyChanged(BindableObject element, object oldValue,
if (newValue != null)
{
var enumType = typeof(CollapseStyle);
var instance = (element as WindowsCollapseStyleChangerPage)!;
var instance = (WindowsCollapseStyleChangerPage)element;
instance.picker.SelectedIndex = Array.IndexOf(Enum.GetNames(enumType), Enum.GetName(enumType, instance.ParentPage.On<Microsoft.Maui.Controls.PlatformConfiguration.Windows>().GetCollapseStyle()));
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ static void OnParentPagePropertyChanged(BindableObject element, object oldValue,
{
if (newValue != null)
{
var instance = element as WindowsCollapseWidthAdjusterPage;
var instance = (WindowsCollapseWidthAdjusterPage)element;
instance!.entry.Text = instance.ParentPage.On<Microsoft.Maui.Controls.PlatformConfiguration.Windows>().CollapsedPaneWidth().ToString();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ static void OnParentPagePropertyChanged(BindableObject element, object oldValue,
if (newValue != null)
{
var enumType = typeof(ToolbarPlacement);
var instance = element as WindowsToolbarPlacementChangerPage;
instance!.picker.SelectedIndex = Array.IndexOf(Enum.GetNames(enumType), Enum.GetName(enumType, instance.ParentPage.On<Microsoft.Maui.Controls.PlatformConfiguration.Windows>().GetToolbarPlacement()));
var instance = (WindowsToolbarPlacementChangerPage)element;
instance.picker.SelectedIndex = Array.IndexOf(Enum.GetNames(enumType), Enum.GetName(enumType, instance.ParentPage.On<Microsoft.Maui.Controls.PlatformConfiguration.Windows>().GetToolbarPlacement()));
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public iOSSafeAreaPage()
void OnButtonClicked(object sender, EventArgs e)
{
On<iOS>().SetUseSafeArea(false);
(sender as Button)!.IsEnabled = false;
((Button)sender).IsEnabled = false;
}
}
}
Loading