Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8334051
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T03:13:26+00:00 2026-06-09T03:13:26+00:00

I am simply trying to query the WP7 device’s camera resolutions, and add these

  • 0

I am simply trying to query the WP7 device’s camera resolutions, and add these resolutions to a ListPicker so that a user may choose the resolution that he or she desires for a videobrush. My videobrush is displayed on my MainPage, and the resolutions ListPicker is on my SettingsPage, so I will also need to pass this value from the SettingsPage to the MainPage so that the chosen resolution will be applied properly. So far what I have is as follows, although I am unsure of how to get the resolutions and add them to the ListPicker and then pass this value to be used in the MainPage?

MainPage.xaml

<Border x:Name="videoRectangle" Grid.Row="0" Grid.ColumnSpan="2" >
            <Border.Background>
                <VideoBrush  x:Name="viewfinderBrush">
                    <VideoBrush.RelativeTransform>
                        <CompositeTransform x:Name="viewfinderBrushTransform" CenterX=".5" CenterY=".5" Rotation="90" />
                    </VideoBrush.RelativeTransform>
                </VideoBrush>
            </Border.Background>
 </Border>

MainPage.xaml.cs

#region Fields
    //Declare a field of type PhotoCamera that will hold a reference to the camera
    private PhotoCamera camera;        

    #endregion

    #region Ctr

    // Constructor
    public MainPage()
    {
        InitializeComponent();
    }

    #endregion

    #region Navigation

    protected override void OnNavigatedTo(NavigationEventArgs e)
    {
        //if camera = null {  .. } <-- is this necessary beforehand?
        // Check to see if the camera is available on the device.
        if ((PhotoCamera.IsCameraTypeSupported(CameraType.Primary) == true) ||
             (PhotoCamera.IsCameraTypeSupported(CameraType.FrontFacing) == true))
        {
            // Initialize the camera, when available.
            if (PhotoCamera.IsCameraTypeSupported(CameraType.Primary))
            {
                // Use front-facing camera if available.
                camera = new PhotoCamera(CameraType.Primary);

                camera.Initialized += camera_Initialized;
                viewfinderBrush.SetSource(camera);
            }
            else
            {
                // The Primary camera is not supported on the device.
                this.Dispatcher.BeginInvoke(delegate()
                {
                    // Write message.
                    MessageBox.Show("Primary camera is not available on this device.", "Error!", MessageBoxButton.OK);
                });
            }
        }
        else
        {
            // No camera is supported on the device.
            //this.Dispatcher.BeginInvoke(delegate()
            //{
                // Write message.
                MessageBox.Show("Primary camera is available on this device.", "Error!", MessageBoxButton.OK);
            //});
        }

        base.OnNavigatedTo(e);
    }

    protected override void OnNavigatedFrom(NavigationEventArgs e)
    {
        if (camera != null)
        {
            camera.Dispose();
            camera.Initialized -= camera_Initialized;
            camera = null;
        }

        base.OnNavigatedFrom(e);
    }

    #endregion

    void camera_Initialized(object sender, CameraOperationCompletedEventArgs e)
    {
        if (e.Succeeded)
        {
            //var res = from resolution in camera.AvailableResolutions
            //          //change to best resolution on camera
            //          //http://msdn.microsoft.com/en-us/library/hh202951(v=VS.92).aspx
            //          where resolution.Width == 640
            //          select resolution;

            //camera.Resolution = res.First();

            //***apply camera resolution here!?

            this.Dispatcher.BeginInvoke(delegate()
            {
                ShowRegularVideo();
            });
        }

        //throw new NotImplementedException();
    }

    private void ShowRegularVideo()
    {
        videoRectangle.Width = this.ActualWidth;
        videoRectangle.Height = this.ActualHeight;
    }

SettingsPage.xaml

<toolkit:ListPicker x:Name="ResolutionListPicker" Header="Resolutions" Grid.Row="3" Grid.ColumnSpan="2"                                            
                                        SelectedIndex="{Binding}"
                                        SelectionChanged="ResolutionListPicker_SelectionChanged"/>

SettingsPage.xaml.cs

#region Fields

    //Declare a field of type PhotoCamera that will hold a reference to the camera
    private PhotoCamera camera; 

    List<int> resolutionsList;

    #endregion

    #region Ctr

    public Settings()
    {
        InitializeComponent();
    }

    #endregion

    #region Navigation

    protected override void OnNavigatedTo(NavigationEventArgs e)
    {
        base.OnNavigatedTo(e);

        GetResolutions();
    }

    protected override void OnNavigatedFrom(NavigationEventArgs e)
    {
        base.OnNavigatedFrom(e);
    }

    #endregion

    private void GetResolutions()
    {
        resolutionsList = new List<int>();

        //var res = from resolution in camera.AvailableResolutions
        //          //change to best resolution on camera
        //          //http://msdn.microsoft.com/en-us/library/hh202951(v=VS.92).aspx
        //          where resolution.Width == 640
        //          select resolution;

        //camera.Resolution = res.First();

        for (int i = 0; i < camera.AvailableResolutions.Count(); i++)
        {
            //resolutionsList.Add(...)
        }
    }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T03:13:27+00:00Added an answer on June 9, 2026 at 3:13 am

    I think you started with How to: Create a Base Camera Application for Windows Phone
    http://msdn.microsoft.com/en-us/library/hh202956(v=vs.92).aspx

    if you look at the Res button, it shows you how to change resolution. If not have a look at How to: Adjust Captured Picture Resolution in an Application for Windows Phone
    http://msdn.microsoft.com/en-us/library/hh202951(v=vs.92).aspx

    Camera.AvailableResolutions
    http://msdn.microsoft.com/en-us/library/microsoft.devices.camera.availableresolutions(v=vs.92).aspx

    Resolutions are a collection of Size structures. Each Size specifies a Height and Width property.
    Pixelcount = Height x Width

    Then you divide it to get Kilo pixel or Mega pixel by dividing appropriately with 1024

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to add a row to an InnoDB table with a simply query:
I'm trying to write a LINQ query that that simply gets the count of
I am trying to write a simple correlated sub query that deletes all records
I am simply trying to query all details present in Users table: select *
Trying to simply run a query of domain objects using find all and it's
I have solr query that simply returns the most recent items in the index.
I'm trying to simply get contacts from the Device phone book and display them
I'm trying to execute a more or less advanced query with Mongoid that basically
I am trying to construct an sql query using a while loop that increments
I'm trying to make a Linq query that will retrieve a string value from

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.