2010-01-06 4 views
3

나 또는 MultiScaleImage가 너비와 높이가 명시 적으로 표시되지 않습니까? 왠지 그리드 셀을 채울 수 없습니다. 그것은 다른 대부분의 요소와 다르게 작동합니다.Silverlight MultiScaleImage에서 사용 가능한 공간을 채우지 않습니다.

뷰어에서 높이와 너비를 긋는 경우 전혀 표시되지 않습니다.

편집 : 여기에 완전한 그림은 ... XAML :

<UserControl x:Class="CliqueSite.DeepZoom.Viewer.ZoomPage" 
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> 
<Grid x:Name="LayoutRoot" Background="Black"> 
    <Grid.RowDefinitions> 
     <RowDefinition Height="*" /> 
     <RowDefinition Height="34" /> 
    </Grid.RowDefinitions> 
    <Grid.ColumnDefinitions> 
     <ColumnDefinition Width="*" /> 
    </Grid.ColumnDefinitions> 
    <MultiScaleImage x:Name="Viewer" Margin="1,1,1,0" Height="675" Width="900" /> 
    <Rectangle Grid.Row="1"> 
     <Rectangle.Fill> 
      <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0"> 
       <GradientStop Color="#FF000000"/> 
       <GradientStop Color="#FF808080" Offset="1"/> 
      </LinearGradientBrush> 
     </Rectangle.Fill> 
    </Rectangle> 
    <Button HorizontalAlignment="Right" Margin="0,0,4,4" VerticalAlignment="Bottom" Padding="6" Grid.Row="1" 
      Content="Zoom Reset" x:Name="ZoomReset" FontSize="9" FontFamily="Verdana" /> 
</Grid> 

뒤에

관련 코드 : (포함 된 개체의 온로드의 PARAM에서 실행)

[ScriptableMember] 
public void SetSource(int width, int height, int tileSize, int id, string urlToFormat) 
{ 
    Viewer.Source = new ViewerSource(width, height, tileSize, id, urlToFormat); 
    double x = 0; 
    double y = 0; 
    double w = 1; 
    if ((width > height && Viewer.Width > Viewer.Height) || (width > height && Viewer.Width < Viewer.Height)) 
    { 
     double scaleFactor = Viewer.Width/width; 
     double adjustedHeight = height * scaleFactor; 
     double topSpace = (Viewer.Height - adjustedHeight)/2; 
     y = -(topSpace/Viewer.Height) * (Viewer.Height/Viewer.Width); 
    } 
    else 
    { 
     double scaleFactor = Viewer.Height/height; 
     double adjustedWidth = width * scaleFactor; 
     w = Viewer.Width/adjustedWidth; 
     double leftSpace = (Viewer.Width - adjustedWidth)/2; 
     x = -(leftSpace/Viewer.Width) * w; 
    } 
    _viewportOrigin = new Point(x, y); 
    _viewportWidth = w; 
    ResetZoom(); 
} 

자바 스크립트 코드 :

function LoadImage() { 
    var viewer = $("#DeepZoomViewer")[0]; 
    viewer.content.Bridge.SetSource(<%= Model.ZoomProperties.Width %>, <%= Model.ZoomProperties.Height %>, 256, <%= Model.Photo.ID %>, "http://localhost:7070/TileHandler.ashx?id={0}&level={1}&x={2}&y={3}"); 
} 
+0

편집 내 대답. – AnthonyWJones

+0

그랬다면 대답으로 표시했을 것입니다. –

답변

0

다음과 같이 그리드 셀 정의를 변경해보십시오 : -

<Grid.RowDefinitions> 
    <RowDefinition Height="*" /> 
    <RowDefinition Height="34" /> 
</Grid.RowDefinitions> 
<Grid.ColumnDefinitions> 
    <ColumnDefinition Width=*" /> 
</Grid.ColumnDefinitions> 

그것은 이미지의 "자연"크기 (거대 할 것이다)를 지정하는 MultiscaleImage 제어에 대한 이해가되지 않습니다. 따라서 크기가 주어 지거나 사용 가능한 크기로 늘어나기를 기대합니다. 당신은 보장하기 위해 그리드의 행/열 정의에 *를 사용할 필요가있는 그리드가 MultiscaleImage 제어에 배치되는 셀 위치에 전달되는 장소 인 컨트롤의 나머지 사용 가능한 크기.

편집

또한 MSI 컨트롤

VerticalAlignment="Stretch" HorizontalAlignment="Stretch" 

특성을 추가한다.

+0

아니 ... 여기 기쁨이 없습니다. 나는 네가 옳았다 고 생각했지만 MSI는 여전히 높이나 너비가 없다. –

+0

Nope ... 변경하지 마십시오. 텍스트 블록에 너비를 바인딩하면 항상 0을 표시합니다.

1

나는 다음과 같이 자동으로 승/시간을 설정하면 그것은 나를 위해 잘 행 공을 채 웁니다 :

<MultiScaleImage x:Name="Viewer" Margin="1,1,1,0" Height="Auto" Width="Auto" /> 

당신은 심지어 추가 조치에 대한 행에 던질 수 있지만, 필요하지 않은 때 그랬어 :

<MultiScaleImage Grid.Row="0" x:Name="Viewer" Margin="1,1,1,0" Height="Auto" Width="Auto" /> 
+0

작업. 내 문제로 더 깊은 무언가가 있어야합니다. 개체의 onload 매개 변수를 실행하도록 설정 한 (브리지를 통해) 이미지 원본을 설정하는 자바 스크립트 호출이 있습니다. 다시 말하지만, 명시적인 높이/너비 세트가있을 때 작동합니다. –

+0

js 호출 및 문제 재현에 도움이 될 수있는 기타 항목을 포함하여 더 많은 코드 게시를 고려하십시오. –

관련 문제