I've run into (yet another) bug with the preferences screen of my extension. When browser.preferences.animateFadeIn is set to true (as it is on Mac), the window size should change to fit the content exactly on switching panes. Instead it is sized to the largest pane when the window is opened, but it changes by as much as it should when switching panes. If that's not too clear, here is a screencast: http://files.droplr.com/files/22337488/4IVT.ScreenFlow.mov
Even after removing all <script> elements, and most of the panes, the error still happens:
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
<?xml-stylesheet href="chrome://browser/skin/preferences/preferences.css" type="text/css"?>
<?xml-stylesheet href="chrome://nextplease/skin/nextpleasePreferences.css" type="text/css"?>
<!DOCTYPE window SYSTEM "chrome://nextplease/locale/nextplease.dtd">
<prefwindow id="nextpleaseprefs" title="&options.title;"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<prefpane id="nextplease.images" label="&options.images.title;" image="chrome://nextplease/skin/Image.png">
<preferences>
<preference id="nextimages" name="nextplease.nextimage.expr0" type="unichar"/>
<preference id="previmages" name="nextplease.previmage.expr0" type="unichar"/>
<preference id="firstimages" name="nextplease.firstimage.expr0" type="unichar"/>
<preference id="lastimages" name="nextplease.lastimage.expr0" type="unichar"/>
</preferences>
<hbox flex="1">
<listbox width="80" onselect="nextplease.selectedPanelChanged(this);">
<listitem label="&options.next;" selected="true"/>
<listitem label="&options.prev;"/>
<listitem label="&options.first;"/>
<listitem label="&options.last;"/>
</listbox>
<separator class="groove" orient="vertical" style="opacity: 0.5; margin-top: 5px; margin-bottom: 5px;"/>
<vbox flex="1">
<deck flex="1">
<listbox id="Next_Image_list" seltype="multiple" flex="1"
onkeypress="nextplease.removeSelectedOnDelete(event, this);" onselect="nextplease.enableDisableRemoveButton(this);" onchange="nextplease.syncListboxToPref(this);"/>
<listbox id="Prev_Image_list" seltype="multiple" flex="1"
onkeypress="nextplease.removeSelectedOnDelete(event, this);" onselect="nextplease.enableDisableRemoveButton(this);" onchange="nextplease.syncListboxToPref(this);"/>
<listbox id="First_Image_list" seltype="multiple" flex="1"
onkeypress="nextplease.removeSelectedOnDelete(event, this);" onselect="nextplease.enableDisableRemoveButton(this);" onchange="nextplease.syncListboxToPref(this);"/>
<listbox id="Last_Image_list" seltype="multiple" flex="1"
onkeypress="nextplease.removeSelectedOnDelete(event, this);" onselect="nextplease.enableDisableRemoveButton(this);" onchange="nextplease.syncListboxToPref(this);"/>
</deck>
<hbox id="images_dummy_texts" collapsed="true">
<textbox id="Next_Image_dummy_text" preference="nextimages" onchange="nextplease.syncPrefToListbox(this);"/>
<textbox id="Prev_Image_dummy_text" preference="previmages" onchange="nextplease.syncPrefToListbox(this);"/>
<textbox id="First_Image_dummy_text" preference="firstimages" onchange="nextplease.syncPrefToListbox(this);"/>
<textbox id="Last_Image_dummy_text" preference="lastimages" onchange="nextplease.syncPrefToListbox(this);"/>
</hbox>
<separator class="thin"/>
<hbox align="stretch">
<textbox type="text" maxlength="256" onkeypress="nextplease.addOnReturn(event, this);"/>
<button label="&options.add;" style="margin-left: 0"
oncommand="nextplease.addToListbox(this);"/>
<spacer flex="1" minwidth="15"/>
<button label="&options.removeSelected;" disabled="true" style="margin-right: 2px"
oncommand="nextplease.removeSelectedFromListbox(this);"/>
<spacer flex="1" minwidth="40"/>
<button label="&options.restoreDefault;"
oncommand="nextplease.restoreDefaultListbox(this);"/>
</hbox>
</vbox>
</hbox>
</prefpane>
<prefpane id="nextplease.debug" label="&options.debug.title;" image="chrome://nextplease/skin/Settings.png">
<preferences>
<preference id="log" name="nextplease.log" type="bool"/>
<preference id="log.detailed" name="nextplease.log.detailed" type="bool"/>
<preference id="log.file" name="nextplease.log.file" type="bool"/>
<preference id="highlight" name="nextplease.highlight" type="bool"/>
<preference id="highlight.color" name="nextplease.highlight.color" type="string"/>
<preference id="highlight.prefetched" name="nextplease.highlight.prefetched" type="bool"/>
<preference id="highlight.prefetched.color" name="nextplease.highlight.prefetched.color" type="string"/>
</preferences>
<vbox>
<checkbox label="&options.log.normal;" preference="log"/>
<checkbox label="&options.log.detailed;" preference="log.detailed"/>
<!--<checkbox id="nextplease.log.file" label="&options.log.file;" preference="log.file/>-->
<separator/>
<hbox>
<checkbox label="&options.highlight;"
preference="highlight"
oncommand="nextplease.enableDisableHighlightColorPickers();"/>
<colorpicker type="button" preference="highlight.color"/>
</hbox>
<hbox>
<checkbox label="&options.highlight.prefetched;"
preference="highlight.prefetched"
oncommand="nextplease.enableDisableHighlightColorPickers();"/>
<colorpicker type="button" preference="highlight.prefetched.color"/>
</hbox>
</vbox>
</prefpane>
</prefwindow>
Yes, I'd agree that it's a bug. When the first pane loads, the prefwindow sizes itself to its content. In your case, this includes several "background" panes. Unfortunately the code to detect this gets bypassed in the animating case. The current code looks something like this:
if (animation) {
if (switching)
animate();
} else {
if (panes > 1)
fixHeight();
}
It should instead look something like this:
if (animation && switching)
animate();
else if (panes > 1)
fixHeight();
This would fix the height of the first pane even when animation was enabled. (If there is only one pane then there is nothing to do of course.)
Related
I have the exact same issue as asked in this question. The tabbar changes color when there is content behind it. However, as stated in this question, if they remove the renderer then their problem stops. I currently do not have a renderer at all and still have this problem. The only part of my code that doesn't have this problem are pages that are not in the shell hierarchy and that are navigated to using the following line of code:
var search = new SearchList();
Navigation.PushAsync(search);
The pages that are navigated to using the style of the following lines of code have the tabbar issue:
await Shell.Current.GoToAsync($"//{nameof(MemberList)}");
The xaml and code behind for the different pages are the exact same. The only difference is one is defined in the appshell hierarchy(MemberList) and the other is not(SearchList) as seen below:
<Shell xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:SampleYE.Views"
Title="SampleYE"
x:Class="SampleYE.AppShell"
>
<!--
The overall app visual hierarchy is defined here, along with navigation.
https://learn.microsoft.com/xamarin/xamarin-forms/app-fundamentals/shell/
-->
<Shell.Resources>
<ResourceDictionary>
<Style x:Key="BaseStyle" TargetType="Element">
<Setter Property="Shell.BackgroundColor" Value="{StaticResource Primary}" />
<Setter Property="Shell.ForegroundColor" Value="{StaticResource Secondary}" />
<Setter Property="Shell.TitleColor" Value="{StaticResource Secondary}" />
<Setter Property="Shell.DisabledColor" Value="#AD94BB" />
<Setter Property="Shell.UnselectedColor" Value="{StaticResource Tertiary}" />
<Setter Property="Shell.TabBarBackgroundColor" Value="{StaticResource Primary}" />
<Setter Property="Shell.TabBarForegroundColor" Value="{StaticResource Secondary}"/>
<Setter Property="Shell.TabBarUnselectedColor" Value="{StaticResource Tertiary}"/>
<Setter Property="Shell.TabBarTitleColor" Value="{StaticResource Secondary}"/>
</Style>
<Style TargetType="TabBar" BasedOn="{StaticResource BaseStyle}" />
<Style TargetType="FlyoutItem" BasedOn="{StaticResource BaseStyle}" />
</ResourceDictionary>
</Shell.Resources>
<TabBar>
<ShellContent Route="StartupPage" Shell.FlyoutBehavior="Disabled" ContentTemplate="{DataTemplate local:StartupPage}" />
</TabBar>
<TabBar>
<Tab Title="Directory" Icon="icon_feed.png">
<ShellContent Route="MemberList" ContentTemplate="{DataTemplate local:MemberList}"/>
</Tab>
<Tab Title="Profile" Icon="icon_about.png">
<ShellContent Route="ProfilePage1" ContentTemplate="{DataTemplate local:ProfilePage1}" />
</Tab>
</TabBar>
<!--
If you would like to navigate to this content you can do so by calling
await Shell.Current.GoToAsync("//LoginPage");
-->
<TabBar>
<ShellContent Route="LoginPage1" Shell.FlyoutBehavior="Disabled" ContentTemplate="{DataTemplate local:LoginPage1}" />
</TabBar>
</Shell>
The definition of the pages with the issue are as follows:
<ContentPage
xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="SampleYE.Views.MemberList">
<ContentPage.Content>
<ListView x:Name="listView" ItemSelected="OnItemSelected" IsGroupingEnabled="true">
<ListView.GroupHeaderTemplate>
<DataTemplate>
<ViewCell>
<StackLayout Padding="5,0,0,0" VerticalOptions="StartAndExpand" Orientation="Vertical">
<Label Text="{Binding Title}" VerticalTextAlignment="Center" />
</StackLayout>
</ViewCell>
</DataTemplate>
</ListView.GroupHeaderTemplate>
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<StackLayout HorizontalOptions="StartAndExpand" Orientation="Horizontal">
<Image WidthRequest="44" HeightRequest="44" Source="{Binding Photo}" />
<StackLayout Padding="5,0,0,0" VerticalOptions="StartAndExpand" Orientation="Vertical">
<Label Text="{Binding Name}" VerticalTextAlignment="Center" Font="Medium" />
<Label Text="{Binding Title}" VerticalTextAlignment="Center" Font="Micro" />
</StackLayout>
</StackLayout>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</ContentPage.Content>
</ContentPage>
<ContentPage.Content>
<Grid RowDefinitions="Auto">
<ScrollView Grid.Row="0" >
<Grid RowDefinitions="Auto,Auto,Auto,Auto" ColumnDefinitions="*,*" VerticalOptions="CenterAndExpand"
RowSpacing="25">
<Frame Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" BorderColor="{StaticResource Secondary}"
VerticalOptions="Start" HorizontalOptions="Center" WidthRequest="150" HeightRequest="150"
CornerRadius="75" HasShadow="False" Padding="0" IsClippedToBounds="True">
<Image Source="Profile" Aspect="AspectFill"/>
</Frame>
<Button Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2"
TextColor="{StaticResource Primary}" BackgroundColor="{StaticResource Secondary}"
HeightRequest="54" WidthRequest="54" CornerRadius="27" TranslationX="65"
ImageSource="Camera" HorizontalOptions="Center" VerticalOptions="End"/>
<Frame Grid.Row="2" Grid.ColumnSpan="2" IsClippedToBounds="True"
Margin="20,20,20,0" CornerRadius="15" Padding="0,20,0,20" >
<Grid RowDefinitions="*,*,*" ColumnDefinitions="*,*,*,*" RowSpacing="12" ColumnSpacing="5">
<Label Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2" HorizontalTextAlignment="Center"
Text="Calvin"/>
<Label Grid.Row="0" Grid.Column="2" Grid.ColumnSpan="2" HorizontalTextAlignment="Center"
Text="Carter"/>
<Label Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" HorizontalTextAlignment="Center"
Text="Ace"/>
<Label Grid.Row="1" Grid.Column="2" Grid.ColumnSpan="2" HorizontalTextAlignment="Center"
Text="Wrecking Ball"/>
<Label Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="2" HorizontalTextAlignment="Center"
Text="Spring"/>
<Label Grid.Row="2" Grid.Column="2" Grid.ColumnSpan="2" HorizontalTextAlignment="Center"
Text="2014"/>
</Grid>
</Frame>
<Frame Grid.Row="3" Grid.ColumnSpan="2" IsClippedToBounds="False"
Margin="20,20,20,0" CornerRadius="15" Padding="0,20,0,45" >
<Grid RowDefinitions="*,Auto,Auto,*" ColumnDefinitions="*,*,*,*" RowSpacing="20" ColumnSpacing="5" >
<Label Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="4" HorizontalTextAlignment="Center"
Text="02/01/1994"/>
<Label Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="4" HorizontalTextAlignment="Center"
Text="Wreckingball14"/>
<Label Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="2" HorizontalTextAlignment="Center"
Text="CCC#blackhousedevelopers.com"/>
<Label Grid.Row="2" Grid.Column="2" Grid.ColumnSpan="2" HorizontalTextAlignment="Center"
Text="Wrecking Ball"/>
<Label Grid.Row="3" Grid.Column="0" Grid.ColumnSpan="2" HorizontalTextAlignment="Center"
Text="Spring"/>
<Label Grid.Row="3" Grid.Column="2" Grid.ColumnSpan="2" HorizontalTextAlignment="Center"
Text="2014"/>
</Grid>
</Frame>
<Grid
Grid.Row="4" Grid.ColumnSpan="2" IsClippedToBounds="False"
Margin="20,0,20,0" Padding="0,20,0,20"
RowDefinitions="Auto,Auto" ColumnDefinitions="*,*" RowSpacing="20" >
<Frame IsClippedToBounds="true" Grid.Row="0" Grid.ColumnSpan="2"
Padding="0"
CornerRadius="15">
<Editor HeightRequest="70" x:Name="interestEntry"
BackgroundColor="{StaticResource Primary}" TextColor="{StaticResource Secondary}"
Placeholder="Interests (i.e. UFC, Fishing, Investing etc;)"
PlaceholderColor="{StaticResource Secondary}"/>
</Frame >
<Frame IsClippedToBounds="true" Grid.Row="1" Grid.ColumnSpan="2"
Padding="0"
CornerRadius="15">
<Editor HeightRequest="140" x:Name="bioEntry"
BackgroundColor="{StaticResource Primary}" TextColor="{StaticResource Secondary}"
Placeholder="Biography (A little information about yourself)"
PlaceholderColor="{StaticResource Secondary}"/>
</Frame>
</Grid>
</Grid>
</ScrollView>
</Grid>
</ContentPage.Content>
The fix to this was updating my ios project to a newer version. they fixed it in the update.
Hello Im trying to use a Xamarin Toolkit Expander in a ViewCell of a ListView.
On android works as expected without any problem but on iOs looks like the ViewCell is not changing its size and the content of the expander is not usable.
It has a strange behaviour because if I scroll up enough to hide the header looks like the cell resizes itself and the content works fine but when clicking again the header the content hides but the cell keeps on the same size
Here is the xaml code
<ViewCell>
<Frame Margin="0,10,0,0" Padding="0">
<StackLayout Orientation="Horizontal" BackgroundColor="White" Padding="0">
<BoxView BackgroundColor="#FF9A31" HeightRequest="15" WidthRequest="15"/>
<behaviors:Expander Margin="10,0,10,0" HorizontalOptions="FillAndExpand" BackgroundColor="White" x:Name="Expander">
<behaviors:Expander.Header>
<StackLayout Orientation="Horizontal">
<Label Text="{Binding NombreCliente}" FontSize="25" TextColor="Gray"/>
<Image Source="adultos.png" HeightRequest="20" Margin="20,0,0,0">
<Image.Triggers>
<DataTrigger TargetType="Image"
Binding="{Binding Source={RelativeSource AncestorType={x:Type behaviors:Expander}}, Path=IsExpanded}"
Value="True">
<Setter Property="IsVisible"
Value="False" />
</DataTrigger>
</Image.Triggers>
</Image>
<Label Text="{Binding PaxAdultos}" x:Name="AdultsHeaderText" FontSize="20" VerticalOptions="CenterAndExpand" TextColor="Gray">
<Label.Triggers>
<DataTrigger TargetType="Label"
Binding="{Binding Source={RelativeSource AncestorType={x:Type behaviors:Expander}}, Path=IsExpanded}"
Value="True">
<Setter Property="IsVisible"
Value="False" />
</DataTrigger>
</Label.Triggers>
</Label>
<Image Source="ninos.png" HeightRequest="20">
<Image.Triggers>
<DataTrigger TargetType="Image"
Binding="{Binding Source={RelativeSource AncestorType={x:Type behaviors:Expander}}, Path=IsExpanded}"
Value="True">
<Setter Property="IsVisible"
Value="False" />
</DataTrigger>
</Image.Triggers>
</Image>
<Label Text="{Binding PaxNinos}" x:Name="NinosHeaderText" FontSize="20" VerticalOptions="CenterAndExpand" TextColor="Gray">
<Label.Triggers>
<DataTrigger TargetType="Label"
Binding="{Binding Source={RelativeSource AncestorType={x:Type behaviors:Expander}}, Path=IsExpanded}"
Value="True">
<Setter Property="IsVisible"
Value="False" />
</DataTrigger>
</Label.Triggers>
</Label>
<Image Source="bebe.png" HeightRequest="20">
<Image.Triggers>
<DataTrigger TargetType="Image"
Binding="{Binding Source={RelativeSource AncestorType={x:Type behaviors:Expander}}, Path=IsExpanded}"
Value="True">
<Setter Property="IsVisible"
Value="False" />
</DataTrigger>
</Image.Triggers>
</Image>
<Label Text="{Binding PaxBebes}" x:Name="BebesHeaderText" FontSize="20" VerticalOptions="CenterAndExpand" TextColor="Gray">
<Label.Triggers>
<DataTrigger TargetType="Label"
Binding="{Binding Source={RelativeSource AncestorType={x:Type behaviors:Expander}}, Path=IsExpanded}"
Value="True">
<Setter Property="IsVisible"
Value="False" />
</DataTrigger>
</Label.Triggers>
</Label>
<Image HeightRequest="20" Source="arrow_down.png" HorizontalOptions="EndAndExpand">
<Image.Triggers>
<DataTrigger TargetType="Image"
Binding="{Binding Source={RelativeSource AncestorType={x:Type behaviors:Expander}}, Path=IsExpanded}"
Value="True">
<Setter Property="Source"
Value="arrow_up.png" />
</DataTrigger>
</Image.Triggers>
</Image>
</StackLayout>
</behaviors:Expander.Header>
<behaviors:Expander.Content>
<StackLayout Orientation="Vertical" Padding="0,10">
<StackLayout Orientation="Horizontal">
<Image Source="adultos.png" HeightRequest="25" Margin="30,0,0,0" />
<ImageButton Source="menos.png" WidthRequest="20" BackgroundColor="Transparent" Margin="44,0" x:Name="menosAdultos" Clicked="OnLessAdults" CommandParameter="{Binding .}"/>
<Label x:Name="nAdultsText" Text="{Binding PaxAdultos}" FontSize="20" TextColor="Gray" />
<ImageButton Source="mas.png" WidthRequest="20" HeightRequest="15" BackgroundColor="Transparent" Margin="44,0" x:Name="masAdultos" Clicked="OnMoreAdults" CommandParameter="{Binding .}"/>
</StackLayout>
<StackLayout Orientation="Horizontal" Margin="0,10,0,0">
<Image Source="ninos.png" HeightRequest="25" Margin="30,0,0,0"/>
<ImageButton Source="menos.png" WidthRequest="20" BackgroundColor="Transparent" Margin="44,0" x:Name="menosNinos" Clicked="OnLessKids" CommandParameter="{Binding .}"/>
<Label x:Name="nKidsText" Text="{Binding PaxNinos}" FontSize="20" TextColor="Gray"/>
<ImageButton Source="mas.png" WidthRequest="20" HeightRequest="15" BackgroundColor="Transparent" Margin="44,0" x:Name="masNinos" Clicked="OnMoreKids" CommandParameter="{Binding .}"/>
</StackLayout>
<StackLayout Orientation="Horizontal" Margin="0,10,0,0">
<Image Source="bebe.png" HeightRequest="25" Margin="30,0,0,0"/>
<ImageButton Source="menos.png" WidthRequest="20" BackgroundColor="Transparent" Margin="44,0" x:Name="menosBebes" Clicked="OnLessBabies" CommandParameter="{Binding .}"/>
<Label x:Name="nBabiesText" Text="{Binding PaxBebes}" FontSize="20" TextColor="Gray"/>
<ImageButton Source="mas.png" WidthRequest="20" HeightRequest="15" BackgroundColor="Transparent" Margin="44,0" x:Name="masBebes" Clicked="OnMoreBabies" CommandParameter="{Binding .}"/>
</StackLayout>
<Button x:Name="ConfirmarButton" FontSize="12" Text="CONFIRMAR CLIENTE" HorizontalOptions="Center" Padding="10,0" TextColor="White" BackgroundColor="Black" Margin="0,10,0,0" Clicked="ConfirmarButton_Clicked" CommandParameter="{Binding .}"/>
</StackLayout>
</behaviors:Expander.Content>
</behaviors:Expander>
</StackLayout>
</Frame>
</ViewCell>
Isn't it weird that on android works withou any problem but on iOs i am getting this weird behaviour?
Quick question:
Is the TableView in Xamarin.Forms supposed to be all grey like below picture? I was expecting a layout similar to what I'm getting, but with white backgrounds for individual TableSections.
Is this because of iOS 14, something I'm doing wrong or maybe the simulator? I'm also experiencing lack of DatePicker and TimePicker support - works on android but not on iPhone simulator, and I was told this issue was the simulator.
I haven't been able to test it on a real device.
I'm posting my code for the Tableview XAML below.
XAML code
<?xml version="1.0" encoding="UTF-8"?>
<ContentPage
Title="{Binding FullName}"
xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" x:Class="ContactBook.ContactsDetailPage">
<TableView Intent="Form">
<TableRoot>
<TableSection Title="Personal Info">
<EntryCell Label="First Name" Text="{Binding FirstName}" Keyboard="Text" />
<EntryCell Label ="Last Name" Text="{Binding LastName}" Keyboard="Text"/>
</TableSection>
<TableSection Title="Contact Info">
<EntryCell Label="Phone" Text="{Binding Phone}" Keyboard="Telephone"/>
<EntryCell Label="Email" Text="{Binding Email}" Keyboard="Email" />
</TableSection>
<TableSection Title="Other">
<SwitchCell Text="Blocked" On="{Binding IsBlocked}" />
</TableSection>
<TableSection>
<ViewCell>
<Button Text="Save" HorizontalOptions="FillAndExpand" Clicked="Button_Clicked"/>
</ViewCell>
</TableSection>
</TableRoot>
</TableView>
</ContentPage>
You could use ViewCell and StackLayout to achieve that, becuause xxxCell not contain a BackgroundColor pproperty.
For example, code as follows:
<TableSection Title="Contact Info">
<ViewCell>
<StackLayout Orientation="Horizontal" BackgroundColor="White">
<Label Margin="10,0,0,0" Text="Phone" VerticalOptions="Center"/>
<Entry Text="Binding Phone" HorizontalOptions="FillAndExpand" Keyboard="Telephone"/>
</StackLayout>
</ViewCell>
<ViewCell>
<StackLayout Orientation="Horizontal" BackgroundColor="White">
<Label Margin="10,0,0,0" Text="Email" VerticalOptions="Center" />
<Entry Text="Binding Email" HorizontalOptions="FillAndExpand" Keyboard="Email" />
</StackLayout>
</ViewCell>
</TableSection>
<TableSection Title="Other" >
<ViewCell>
<StackLayout Orientation="Horizontal" BackgroundColor="White">
<Label Margin="15,0,0,0" Text="Blocked" VerticalOptions="Center"/>
<Switch Margin="280,0,0,0" />
</StackLayout>
</ViewCell>
</TableSection>
<TableSection>
<ViewCell>
<StackLayout BackgroundColor="White">
<Button Text="Save"
HorizontalOptions="FillAndExpand"
/>
</StackLayout>
</ViewCell>
</TableSection>
</TableRoot>
</TableView>
The effect:
TableView has a BackgroundColor property that lets you set the background color you want. So if you want it to match the rest of your page, you can do
<TableView Intent="Form" BackgroundColor="White">
I have my code below, basically to print out an image.
private async void imageControl_PrintButtonClick(object sender, RoutedEventArgs e)
{
var createBitmapTask = Task.Run(async () =>
{
var stream = await provider.OpenEntryAsRandomAccessStreamAsync(currentImageFile);
var decoder = await BitmapDecoder.CreateAsync(stream);
return await decoder.GetSoftwareBitmapAsync(
BitmapPixelFormat.Bgra8,
BitmapAlphaMode.Premultiplied);
});
var printHelper = new PrintHelper(printPanel);
printHelper.OnPreviewPagesCreated += PrintHelper_OnPreviewPagesCreated;
printPanel.Opacity = 1.0;
var source = new SoftwareBitmapSource();
var bitmap = await createBitmapTask;
await source.SetBitmapAsync(bitmap);
printImage.Source = source;
printFileName.Text = "Hello";
printImage.Height = bitmap.PixelHeight;
printImage.Width = bitmap.PixelWidth;
await printHelper.ShowPrintUIAsync("ZipPicView - " + currentImageFile.ExtractFilename(), true);
printPanel.Opacity = 0;
}
private void PrintHelper_OnPreviewPagesCreated(List<FrameworkElement> obj)
{
ContentDialog dialog = new ContentDialog();
}
However, the print preview shows an empty page. When I print it out, the printer does nothing.
I've tried changing the opacity of the printPanel (which is a Grid object) to non-zero, and the image does display on the screen. Still, the print has nothing on the output page.
I did notice that, on the OnPreviewPagesCreated, its obj parameter has a new object everytime it's called. The first call has one object with both Width and Height as NaN. My guess is because the container has no size, it cannot determine the content size.
Below is the XAML file.
<Page x:Name="page"
x:Class="ZipPicViewUWP.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:ZipPicViewUWP"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:interactivity="using:Microsoft.Xaml.Interactivity"
xmlns:behaviors="using:Microsoft.Toolkit.Uwp.UI.Animations.Behaviors"
mc:Ignorable="d" KeyUp="page_KeyUp" Loaded="page_Loaded" SizeChanged="page_SizeChanged">
<Canvas x:Name="canvas" SizeChanged="canvas_SizeChanged">
<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}" Height="1019" Width="1920">
<Grid x:Name="printPanel" Opacity="0">
<StackPanel x:Name="printContent"
Margin="0,0"
Orientation="Vertical">
<TextBlock x:Name="printFileName" />
<Image x:Name="printImage"
Stretch="Fill" />
</StackPanel>
</Grid>
<SplitView x:Name="splitView" DisplayMode="CompactOverlay" PanePlacement="Left" CompactPaneLength="50" OpenPaneLength="300">
<SplitView.Content>
<GridView x:Name="thumbnailGrid" />
</SplitView.Content>
<SplitView.Pane>
<Grid Background="{StaticResource SidebarBackground}">
<Grid.RowDefinitions>
<RowDefinition Height="50" />
<RowDefinition Height="*" />
<RowDefinition Height="50" />
</Grid.RowDefinitions>
<StackPanel Orientation="Horizontal" Grid.Row="0">
<Button x:Name="subFolderButton" Width="50" Height="50" Background="Transparent" Click="subFolderButton_Click">
<SymbolIcon Symbol="List" />
</Button>
<TextBlock VerticalAlignment="Center" Margin="0,15">Folders</TextBlock>
</StackPanel>
<ScrollViewer Grid.Row="1">
<ListView x:Name="subFolderListCtrl" SelectionChanged="subFolderList_SelectionChanged" DataFetchSize="2" Margin="-10,0,0,0" />
</ScrollViewer>
<ProgressRing x:Name="thumbProgress" Height="30" Width="30" HorizontalAlignment="Left" VerticalAlignment="Center" Grid.Row="2" Margin="10,0,0,10" />
</Grid>
</SplitView.Pane>
</SplitView>
<interactivity:Interaction.Behaviors>
<behaviors:Blur x:Name="BlurBehavior" Duration="500" AutomaticallyStart="False" />
</interactivity:Interaction.Behaviors>
</Grid>
<Border x:Name="imageBorder" Visibility="Collapsed">
<Image x:Name="image" ManipulationMode="TranslateX" ManipulationCompleted="image_ManipulationCompleted" Tapped="image_Tapped">
<interactivity:Interaction.Behaviors>
<behaviors:Blur x:Name="ImageTransitionBehavior" Duration="500" AutomaticallyStart="False" />
</interactivity:Interaction.Behaviors>
</Image>
</Border>
<local:ViewerControl x:Name="imageControl" Visibility="Collapsed" CloseButtonClick="imageControl_CloseButtonClick" NextButtonClick="imageControl_NextButtonClick" PrevButtonClick="imageControl_PrevButtonClick" SaveButtonClick="imageControl_SaveButtonClick" PrintButtonClick="imageControl_PrintButtonClick" />
<Border x:Name="loadingBorder" Visibility="Collapsed">
<ProgressRing IsActive="True" Width="100" Height="100" />
</Border>
</Canvas>
<Page.TopAppBar>
<CommandBar VerticalContentAlignment="Center" VerticalAlignment="Center">
<CommandBar.Content>
<TextBlock Margin="10,0,0,0" x:Name="filenameTextBlock" Text="<None>" UseLayoutRounding="True" />
</CommandBar.Content>
<AppBarToggleButton x:Name="fullscreenButton" Icon="FullScreen" Label="FullScreen" Checked="fullscreenButton_Checked" Unchecked="fullscreenButton_Unchecked" />
<AppBarSeparator />
<AppBarButton x:Name="openFileButton" Icon="OpenFile" Label="Open File" Click="openFileButton_Click" />
<AppBarButton x:Name="openFolderButton" Icon="Folder" Label="Open Folder" Click="openFolderButton_Click" />
</CommandBar>
</Page.TopAppBar>
</Page>
And the source code is here : https://github.com/wutipong/ZipPicViewCS/tree/master/ZipPicViewUWP
I have a slider bound to the volume property of a MediaElement. This works if marked up as below:
<UserControl
x:Class="GenTest.VideoElement"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:GenTest"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
d:DesignHeight="300"
d:DesignWidth="600">
<UserControl.Resources>
<Style x:Name="transportStyle" TargetType="Button">
<Setter Property="Height" Value="40" />
<Setter Property="Width" Value="75" />
<Setter Property="FontSize" Value="11" />
</Style>
<Style x:Name="atransportStyle" TargetType="AppBarButton">
<Setter Property="IsCompact" Value="true" />
<Setter Property="FontSize" Value="11" />
</Style>
</UserControl.Resources>
<Grid Background="{StaticResource ApplicationPageBackgroundThemeBrush}">
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="100"/>
</Grid.RowDefinitions>
<ContentControl x:Name="videoContainer"
KeyUp="VideoContainer_KeyUp"
HorizontalContentAlignment="Center"
VerticalContentAlignment="Center"
Height="400" Grid.Row="0" >
<MediaElement Name="videoMediaElement"
MediaOpened="videoElement_MediaOpened"
MediaEnded="videoMediaElement_MediaEnded"
MediaFailed="videoMediaElement_MediaFailed"
CurrentStateChanged="videoMediaElement_CurrentStateChanged"
AutoPlay="False" />
</ContentControl>
<!-- Transport Controls -->
<StackPanel Name="TransportControlsPanel"
HorizontalAlignment="Center"
Grid.Row="1" >
<Slider Name="timelineSlider" Margin="0,0" Width="500" Height="37"/>
<StackPanel Orientation="Horizontal">
<AppBarButton x:Name="btnPlay" Icon="Play" Click="btnPlay_Click" Style="{StaticResource atransportStyle}" Label="Play"/>
<AppBarButton x:Name="btnStop" Icon="Stop" Click="btnStop_Click" Style="{StaticResource atransportStyle}"/>
<AppBarButton x:Name="btnReverse" Icon="Previous" Click="btnReverse_Click" Style="{StaticResource atransportStyle}"/>
<AppBarButton x:Name="btnForward" Icon="Next" Click="btnForward_Click" Style="{StaticResource atransportStyle}"/>
<Button Name="btnFullScreenToggle" Click="btnFullScreenToggle_Click"
Style="{StaticResource transportStyle}" Content="Full" />
<ComboBox Name="cbAudioTracks"
SelectionChanged="cbAudioTracks_SelectionChanged"
Width="75" />
<AppBarButton x:Name="btnTest" Icon="Other" Style="{StaticResource atransportStyle}">
<AppBarButton.Flyout>
<Flyout>
<StackPanel Orientation="Vertical">
</StackPanel>
</Flyout>
</AppBarButton.Flyout>
</AppBarButton>
<Slider Minimum="0" Maximum="1" StepFrequency="0.1" Height="100" Value="{Binding Mode=TwoWay,
ElementName=videoMediaElement, Path=Volume}" Orientation="Vertical"/>
</StackPanel>
</StackPanel>
</Grid>
</UserControl>
But when I put the slider into the Flyout the Binding no longer works.
<AppBarButton x:Name="btnTest" Icon="Other" Style="{StaticResource atransportStyle}">
<AppBarButton.Flyout>
<Flyout>
<StackPanel Orientation="Vertical">
<Slider Minimum="0" Maximum="1" StepFrequency="0.1" Height="100" Value="{Binding Mode=TwoWay,
ElementName=videoMediaElement, Path=Volume}" Orientation="Vertical"/>
</StackPanel>
</Flyout>
</AppBarButton.Flyout>
</AppBarButton>
There are no errors and I cant do a Binding trace because the TraceListeners have been removed from WinRt. I have tried:
public App()
{
this.InitializeComponent();
this.Suspending += OnSuspending;
this.UnhandledException += App_UnhandledException;
DebugSettings.BindingFailed += OnDebugSettingsOnBindingFailed;
}
private void OnDebugSettingsOnBindingFailed(object sender, BindingFailedEventArgs args)
{
new MessageDialog(args.Message).ShowAsync();
}
But no errors are thrown and there is nothing in the output window. In design mode, using the Properties Windows, if i change the volume value of the videoMediaElement then the Value property of the Slider changes but I cant update the Value of the slider, it's read only.
I can make it work within the flyout if I use code:
private void RangeBase_OnValueChanged(object sender, RangeBaseValueChangedEventArgs e)
{
var slider = sender as Slider;
videoMediaElement.Volume = slider.Value;
}
but then why bother with bindings at all?
I had this kind of errors some times now, I think that Flyouts are handled separately where the Bindings can't look for the ElementName.
I suggest that you should do this with a ViewModel, instead of cross binding in your Page
Slider.Value [TwoWay-Bind] -> ViewModel.Volume
ViewModel.Volume -> videoMediaElement.Volume