logo
down
shadow

Landscape-Portrait orientation in WPF


Landscape-Portrait orientation in WPF

By : user2954899
Date : November 22 2020, 10:33 AM
will help you This is possible. You would create a view that implements both layouts and switches between them using a DataTrigger:
code :
<ContentControl>
    <ContentControl.Style>
        <Style TargetType="ContentControl">
            <Setter Property="Content">
                <Setter.Value>
                    <!-- Put your portrait layout here -->
                </Setter.Value>
            </Setter>
            <Style.Triggers>
                <DataTrigger Binding="{Binding IsLandscape}" Value="True">
                    <Setter Property="Content">
                        <Setter.Value>
                            <!-- Put your landscape layout here -->
                        </Setter.Value>
                    </Setter>
                </DataTrigger>
            </Style.Triggers>
        </Style>
    </ContentControl.Style>        
</ContentControl>
public MainWindow()
{
    this.InitializeComponent();

    this.DataContext = this; // You would put a ViewModel here when using MVVM design pattern
}

public static readonly DependencyProperty IsLandscapeProperty
    = DependencyProperty.Register("IsLandscape",
                                    typeof (bool),
                                    typeof (MainWindow));

public bool IsLandscape
{
    get { return (bool) GetValue(IsLandscapeProperty); }
    set { SetValue(IsLandscapeProperty, value); }
}

private void ChangeOrientation(object sender, RoutedEventArgs e)
{
    this.IsLandscape = !this.IsLandscape;
}
<Window.Resources>
    <Style TargetType="UserControl">
        <Setter Property="HorizontalContentAlignment" Value="Center" />
        <Setter Property="VerticalContentAlignment" Value="Center" />
        <Setter Property="Background" Value="#CCDDEE" />
        <Setter Property="Margin" Value="3" />
    </Style>
</Window.Resources>

<DockPanel>

    <Button DockPanel.Dock="Bottom" Margin="5" Content="Change Orientation"
            Click="ChangeOrientation" />

    <ContentControl>
        <ContentControl.Style>
            <Style TargetType="ContentControl">
                <Setter Property="Content">
                    <Setter.Value>
                        <Grid>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition />
                                <ColumnDefinition />
                            </Grid.ColumnDefinitions>
                            <Grid.RowDefinitions>
                                <RowDefinition />
                                <RowDefinition />
                            </Grid.RowDefinitions>

                            <UserControl Content="Sub 1" />
                            <UserControl Grid.Column="1" Content="Sub 2" />
                            <UserControl Grid.Row="1" Grid.ColumnSpan="2" Content="Main" />
                        </Grid>
                    </Setter.Value>
                </Setter>
                <Style.Triggers>
                    <DataTrigger Binding="{Binding IsLandscape}" Value="True">
                        <Setter Property="Content">
                            <Setter.Value>
                                <Grid>
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition />
                                        <ColumnDefinition />
                                    </Grid.ColumnDefinitions>
                                    <Grid.RowDefinitions>
                                        <RowDefinition />
                                        <RowDefinition />
                                    </Grid.RowDefinitions>

                                    <UserControl Grid.Column="1" Content="Sub 1" />
                                    <UserControl Grid.Column="1" Grid.Row="1" Content="Sub 2" />
                                    <UserControl Grid.RowSpan="2" Content="Main" />
                                </Grid>
                            </Setter.Value>
                        </Setter>
                    </DataTrigger>
                </Style.Triggers>
            </Style>
        </ContentControl.Style>
    </ContentControl>

</DockPanel>


Share : facebook icon twitter icon
populate entire landscape screen with new uiview upon device orientation change from portrait to landscape

populate entire landscape screen with new uiview upon device orientation change from portrait to landscape


By : vesty972
Date : March 29 2020, 07:55 AM
I think the issue was by ths following , So my iPhone application currently has a tabviewcontroller that populates the entire screen. The app only runs in portrait mode. My task has been to detect device orientation changes, and once it changes to landscape, have a new uiview populate the entire screen. , Yes, there is a way to load a new view. I make it in my app that way:
code :
- (void)orientationChanged:(NSNotification *)notification
{
    // We must add a delay here, otherwise we'll swap in the new view
    // too quickly and we'll get an animation glitch
    [self performSelector:@selector(updateLandscapeView) withObject:nil afterDelay:0];
}

- (void)updateLandscapeView
{
    UIDeviceOrientation deviceOrientation = [UIDevice currentDevice].orientation;
    if (UIDeviceOrientationIsLandscape(deviceOrientation) && !isShowingLandscapeView)
    {
        [self presentModalViewController:self.landscapeView animated:YES];
        isShowingLandscapeView = YES;
    }
    else if (deviceOrientation == UIDeviceOrientationPortrait && isShowingLandscapeView)
    {
        [self dismissModalViewControllerAnimated:YES];
        isShowingLandscapeView = NO;
    }    
}
[[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(orientationChanged:)
                                             name:UIDeviceOrientationDidChangeNotification object:nil];
[[NSNotificationCenter defaultCenter] removeObserver:self];
[[UIDevice currentDevice] endGeneratingDeviceOrientationNotifications];
Set portrait for phone but both portrait and landscape orientation for tablet

Set portrait for phone but both portrait and landscape orientation for tablet


By : LaluGanesh
Date : March 29 2020, 07:55 AM
it fixes the issue You can call setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); ine the onCreate method of your Activity if the device is a phone. To determine if the device is a phone or a tablet, you can have a look at this question.
Supporting Universal App with Portrait Orientation on iPhone and Landscape+Portrait on iPad

Supporting Universal App with Portrait Orientation on iPhone and Landscape+Portrait on iPad


By : user3453107
Date : March 29 2020, 07:55 AM
I hope this helps . This is how I managed to get it working. In the AppDelegate.m, I added this method.
code :
- (NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window{
    //if iPad return all orientation
    if ((UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad))
        return UIInterfaceOrientationMaskAll;

    //proceed to lock portrait only if iPhone
    AGTabbarController *tab = (AGTabbarController *)[UIApplication sharedApplication].keyWindow.rootViewController;
    if ([tab.presentedViewController isKindOfClass:[YouTubeVideoPlayerViewController class]])
        return UIInterfaceOrientationMaskAllButUpsideDown;
    return UIInterfaceOrientationMaskPortrait;
}
# pragma mark - UIRotation Methods

- (BOOL)shouldAutorotate{
    return YES;
}

- (NSUInteger)supportedInterfaceOrientations{
    return (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) ? UIInterfaceOrientationMaskAll : UIInterfaceOrientationMaskPortrait;
}
Should I Record Video using DJI Osmo in Landscape or Portrait/Vertical Mode for iPhone Portrait Orientation

Should I Record Video using DJI Osmo in Landscape or Portrait/Vertical Mode for iPhone Portrait Orientation


By : Pooja Verma
Date : March 29 2020, 07:55 AM
wish of those help I recorded my first videos in the DJI portrait/vertical mode position and every time I played them back on my phone they would look fine in iPhone's landscape orientation but in iPhone's portrait orientation the videos would play in the center with a black bar on the top and another black bar on the bottom of it.
I went to the DJI store in Manhattan and the very helpful rep said the problem was I needed to first lock my phone in portrait orientation before recording in the DJI's portrait/vertical mode position to prevent that problem from happening. He said since I didn't have it locked even the iPhone was in a portrait position it was still recording in landscape mode.
IOS 6 Orientations - Only One Viewcontroller supports Landscape & Portrait orientation - else ONLY Portrait

IOS 6 Orientations - Only One Viewcontroller supports Landscape & Portrait orientation - else ONLY Portrait


By : manand
Date : March 29 2020, 07:55 AM
it should still fix some issue You can read this:
Multiple Orientations
Related Posts Related Posts :
  • How to use Addfields in MongoDB C# Aggregation Pipeline
  • MsTest TestCleanup method not called when an unhandled exception is thrown
  • missing last data when exporting gridview to excel
  • How to add array of objects to List in c#
  • Lambda Expression to order (sort) my list collection
  • Library for displaying music notation
  • How to compare two dictionaries in c# and get the output as True and False after validation
  • specify fields to be serialized with JSON
  • How do you obtain the content of a specific node using XmlDocument in C#?
  • How to ignore the first line in a csv file when you read the csv file in C#
  • c# - Problem calling public void from class
  • How to tell a class which objects it should create? Type vs. object confusion :(
  • Save CheckBox state to xml
  • WIX CAQuietExec NETSH Command Fails
  • Issues sending http put request every 60 seconds to RoR app
  • ConfigurationManager.ConnectionStrings.ConnectionString Issue
  • Real size WPF controls for printing
  • How to cancel properly?
  • C# String multiplication error
  • Using Solrnet and Assigning Attributes with Entity Framework Generated POCOs
  • Regex pattern for single backslash
  • TextBox: insert spaces for credit card number?
  • C# DLL loaded for exe-application is not found when launching similar DLL by rundll32.exe
  • Debug a Windows Service with WCF library
  • Open a file from an external assembly?
  • Servicestack RegistrationFeature Unable to bind request
  • Index was outside the bounds of the array confusion
  • Error in Xml to List code. The ':' character, hexadecimal value 0x3A, cannot be included in a name
  • I am trying to do a while loop with a string conditional statement in C#
  • C# 'Cannot access a disposed object. Object name: 'SslStream'.'
  • How to make Gecko use seperate CookieContainer per instance?
  • C# Advanced form "please wait"
  • Send and Receive data C# using network stream
  • How to discover that appsettings changed in C#?
  • Check what needs full trust
  • What is the execution order of an MVC Razor view/layout
  • Table designer (Entity Framework) is too resource intense
  • How to clean up an exception string so it can be displayed via Javascript Alert?
  • Configuring Amazon SES Feedback Notifications via Amazon SNS in ASP.NET MVC (C#)
  • C# api responce and request
  • Dynamodb putitem function not working properly
  • theme in windows phone(light or dark) using c#
  • Backup attached database file(.mdf) using c# and SQL Server
  • What is 'TextFile' and where it is uses in WPF project
  • Using same alias for multiple namespaces
  • how to move mails into separate folders
  • Multithreaded Uploader
  • Memory fragmentation?
  • C# correct exception handling
  • "Could not open macro storage" when accessing using file on another machine
  • How to access other directories of hosted server
  • C# Jagged Array check if value exists/true
  • Why can't I type Clone() properly?
  • exception on accessing dictionary from list
  • Getting the immediate response from server without waiting to 200 message
  • Why am I getting exception Directory Is Not empty?
  • Could not load file or assembly 'CefSharp.dll' or one of its dependencies
  • Sending Email By Using C# in unity3D?
  • Correct usage of await async in webapi
  • Program update code issue
  • shadow
    Privacy Policy - Terms - Contact Us © ourworld-yourmove.org