none
Creating popup window using sliverlight

    Question

  • Can I know is it possible to greyout the parent window while the child window pops out using sliver light. If so how can I do taht
    Thursday, July 03, 2008 3:34 AM

Answers

  •  Have a DIV with absolute position in your page. Call a javascript function from the silverlight page when popup is open. That function will make the div occupy the total screen. Have your silverlight component with a higher z-index. Everything of them will be done from javascript and css. Only you need to call the javascript method at appropriate time with HtmlPage.Window.Invoke Method

    Thursday, July 03, 2008 5:54 AM
  •  jayaganesan

    for the upload you can simply use the fileDialog.

                OpenFileDialog d = new OpenFileDialog();
                d.Filter = "(*.*)|*.*";
                d.Multiselect = true;
                if (d.ShowDialog() == true)
                {
                    foreach (FileDialogFileInfo f in d.SelectedFiles)
                    {
                        Stream s = f.OpenRead();
                        byte[] fileBytes = new byte[s.Length];
                        int byteCount = s.Read(fileBytes, 0, (int)s.Length);
                        string fileContent = Convert.ToBase64String(fileBytes);
                        s.Close();
                        //do your upload here
                    }
                }

    Wednesday, July 09, 2008 1:28 AM

All replies

  •  Have a grey rectangle with opacity say0.5 and make it invisible(Collapsed) and show it over your parent window when you show the pop up

    Thursday, July 03, 2008 3:41 AM
  • Can I get any reference code for that. My actual requirement is simillar to the pop up window that comes from the quick reply link in this forum.

     

    Thursday, July 03, 2008 4:16 AM
  •  Tell me one thing. Your total pagw will be in silverlight. Right. The popup and the parent window behind that.

    Thursday, July 03, 2008 4:17 AM
  •  Here is a quick (and dirty) sample I just made.

     

     <Canvas x:Name="MainCanvas">
                <Button x:Name="MainButton" Content="Click Me to see I am active" Click="MainButton_Click"/>
            </Canvas>
            <Canvas x:Name="Mask" Width="700" Height="700" Background="Gray" Opacity=".7" Visibility="Collapsed"/>
            <Popup x:Name="MyPOP" HorizontalOffset="200" VerticalOffset="200" IsOpen="False"  >
                <StackPanel Width="200" Height="200" Background="Red">
                    <TextBlock Text="This is the popup" />
                    <Button Content="Close pop Up" Click="Button_Click_1"  Width="100" Height="50" />
                </StackPanel>
            </Popup>
            <Button Content="Open pop Up" Click="Button_Click" Width="100" Height="50" />

     

     private void Button_Click(object sender, RoutedEventArgs e)
            {
                MyPOP.IsOpen = true;
                Mask.Visibility = Visibility.Visible;
            }

            private void Button_Click_1(object sender, RoutedEventArgs e)
            {
                MyPOP.IsOpen = false;
                Mask.Visibility = Visibility.Collapsed;
            }

            private void MainButton_Click(object sender, RoutedEventArgs e)
            {
                HtmlPage.Window.Alert("Active");
               
            }

     

    See if it is what you want.

    Thursday, July 03, 2008 4:51 AM
  • Thanks for your reply. Sorry my total page is not in sliver light, can I have only the  popup window in sliver light. Because the parent page may contains more information from the database. For example I may use the popup page to upload some image or to display the copy right information etc... So if I get the sliver light window from asp.net button with greying out the parent window it will be helpful for me.

     

    Thursday, July 03, 2008 5:40 AM
  •  Have a DIV with absolute position in your page. Call a javascript function from the silverlight page when popup is open. That function will make the div occupy the total screen. Have your silverlight component with a higher z-index. Everything of them will be done from javascript and css. Only you need to call the javascript method at appropriate time with HtmlPage.Window.Invoke Method

    Thursday, July 03, 2008 5:54 AM
  • Thank you . I will try and let you know if there is any difficulty

    Thursday, July 03, 2008 6:02 AM
  •  jayaganesan

    for the upload you can simply use the fileDialog.

                OpenFileDialog d = new OpenFileDialog();
                d.Filter = "(*.*)|*.*";
                d.Multiselect = true;
                if (d.ShowDialog() == true)
                {
                    foreach (FileDialogFileInfo f in d.SelectedFiles)
                    {
                        Stream s = f.OpenRead();
                        byte[] fileBytes = new byte[s.Length];
                        int byteCount = s.Read(fileBytes, 0, (int)s.Length);
                        string fileContent = Convert.ToBase64String(fileBytes);
                        s.Close();
                        //do your upload here
                    }
                }

    Wednesday, July 09, 2008 1:28 AM
  • hello

            i can i use popup in datagrid row base .  i mean when user click row or cell it open popup window

    Thursday, May 14, 2009 5:22 AM
  • Friday, June 12, 2009 10:17 AM
  • If you are using silverlight 3 version then you can create Popup as like below

     <Grid x:Name="LayoutRoot" Background="White" >
            <Grid.RowDefinitions>
                <RowDefinition Height="0.15*"/>
                <RowDefinition Height="0.85*"/>
            </Grid.RowDefinitions>

            <Button x:Name="ShowPopup"
                   Height="40"
                  HorizontalAlignment="Left"
                  VerticalAlignment="Bottom"
                  Width="100"
                  FontFamily="Comic Sans MS"
                  FontSize="24"
                  Content="Click me!"/>
            <Image x:Name="LandscapeImage"
                 Margin="20,5,50,50"
                 Grid.Row="1"
                 Source="Desert Landscape.jpg"
                 HorizontalAlignment="Left"
                 VerticalAlignment="Top"/>

            <Popup x:Name="MyPopup"
                 VerticalOffset="75"
                 HorizontalOffset="25">
             <Border BorderBrush="Black" BorderThickness="5">
                   <StackPanel x:Name="PopUpPanel"
                            Background="#FFB9F4E2"
                            Height="Auto" Width="Auto" >
                       <TextBlock  x:Name="PopUpText"
                      Height="143" Width="Auto"
                          Text="Danger Will Robinson!!"
                          FontFamily="Comic Sans MS" FontSize="48"
                      HorizontalAlignment="Center" VerticalAlignment="Center"
                      Foreground="#FFD91F1F"/>
                       <Button x:Name="ClosePopup"
                           Height="34"
                           Width="73"
                           Content="Close"
                           Background="#FF86F922"
                           FontFamily="Verdana" FontSize="14" />
                   </StackPanel>
             </Border>
            </Popup>
        </Grid>
    and in Code Behind

     

     

    public Page()
    {
        // Required to initialize variables
        InitializeComponent();
       Loaded += new RoutedEventHandler( Page_Loaded );
    } 
    
    void Page_Loaded( object sender, RoutedEventArgs e )
    {
       ShowPopup.Click += new RoutedEventHandler( ShowPopup_Click );
       ClosePopup.Click += new RoutedEventHandler( ClosePopup_Click );
    } 
    
    void ClosePopup_Click( object sender, RoutedEventArgs e )
    {
       MyPopup.IsOpen = false;
    } 
    
    void ShowPopup_Click( object sender, RoutedEventArgs e )
    {
       MyPopup.IsOpen = true;
    }
    Thursday, June 17, 2010 8:04 AM
  • http://usamawahabkhan.blogspot.com/2010/04/floatable-childwindow-with-enabled.html
    Thursday, June 17, 2010 8:23 AM
  • <ResourceDictionary  
           
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
            .....   
           
    mc:Ignorable="d"    what is this ? 
           
    d:IsSketchFlowStyle="True"   what is this ? 
           
    d:IsSketchFlowDefaultStyle="True" >   what is this ? 
    <!-- Basic Sketch TextBlock --> 
           
    <Style x:Key="BasicTextBlock-Sketch" TargetType="TextBlock" d:StyleDefaultContent="Basic Text"   >  what is this ? 
                   
    <Setter Property="FontSize" Value="16"/> 
            ......

    Friday, March 16, 2012 1:39 AM