Hello,
I have used silverlight popup control.It has canvas contaner.It works well in IE browser ie at cener position, but when try to open in mozilla or chrome browser then initial it leave its position and it moves at top left corner then after few seconds it comes at center position.So I want to know why this popup has changes its position when open in mozilla or chrome browser.
Below is my xaml code,
<Popup x:Name="puXLModelWait">
<Canvas x:Name="cvsXLwait" Background="#993A3C49" HorizontalAlignment="Center" VerticalAlignment="Center">
<Border x:Name="brXLWait" BorderThickness="1,1,1,1" BorderBrush="#FF49639D" Height="60" Width="250" CornerRadius="2,2,2,2" VerticalAlignment="Center" HorizontalAlignment="Center">
<Border.Background>
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
<GradientStop Color="#FFC5D2F2"/>
<GradientStop Color="#FFFFFFFF" Offset="1"/>
</LinearGradientBrush>
</Border.Background>
<StackPanel>
<StackPanel Height="18" Orientation="Horizontal">
<StackPanel.Background>
<LinearGradientBrush EndPoint="0.5,0" StartPoint="0.5,1">
<GradientStop Color="#FF49639D"/>
<GradientStop Color="#FF6A84C1" Offset="1"/>
</LinearGradientBrush>
</StackPanel.Background>
<TextBlock Text="Download Financials to XLS" HorizontalAlignment="Left" Foreground="White" FontWeight="Bold" VerticalAlignment="Center" Margin="5,0,0,0" ></TextBlock>
<TextBlock x:Name="lblClose" Text="X" Foreground="White" HorizontalAlignment="Right" VerticalAlignment="Center"
ToolTipService.ToolTip="Close" Margin="60,0,0,0" MouseLeftButtonDown="TextBlock_MouseLeftButtonDown"></TextBlock>
</StackPanel>
<StackPanel Orientation="Horizontal" x:Name="pnlXL" HorizontalAlignment="Center" Margin="10">
<TextBlock x:Name="lblWait" Text="Creating XLS, Please wait..." Foreground="Black" FontSize="12" FontWeight="Bold" FontFamily="Arial" ></TextBlock>
<IndigoCommon:ucSpinner x:Name="ucWait" HorizontalAlignment="Right" Margin="5,0,0,0" Width="20"></IndigoCommon:ucSpinner>
</StackPanel>
</StackPanel>
</Border>
</Canvas>
</Popup>
Thanks in advance,
Satyajit Kadam.
Answer: 1
Hi Satyajit Kadam,
If you want to position the Popup at the center of browser window, you can take advantange of Popup.HorizontalOffset and App.Current.Host.Content.ActualWidth, just like this:
public MainPage() { InitializeComponent(); puXLModelWait.HorizontalOffset = App.Current.Host.Content.ActualWidth / 2 - 125; puXLModelWait.VerticalOffset = App.Current.Host.Content.ActualHeight / 2 - 30; }
I have tested it on google-chrome (v21.0.1180.89 m) and Firefox (v15.0.1) and IE (v9.0.8112.16421), and they all works fine.
Best Regards,
No comments:
Post a Comment
Send us your comment related to the topic mentioned on the blog