모든 프로젝트에서 사용 된 모든 이미지를 ResourceDictionary
으로 이동하는 중입니다. Syncfusion Metro Studio를 사용하면 이미지의 XAML 소스를 가져올 수 있습니다. Button WPF의 이미지로 캔버스
<Viewbox x:Shared="false" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<Grid>
<Grid Name="backgroundGrid" Width="48" Height="48" Visibility="Collapsed" />
<Path Data="M0,4.1309996L20.362437,4.1309996C20.038338,4.8125897,19.782439,5.5301299,19.594339,6.2769008L2.1451931,6.2769008 2.1451931,23.445208 30.042807,23.445208 30.042807,20.78887C30.342306,20.81167 30.642406,20.834471 30.949104,20.834471 31.367603,20.834471 31.781102,20.81027 32.188001,20.76737L32.188001,25.590239 20.922435,25.590239 20.922435,27.736771 23.605427,27.736771 23.605427,29.882 8.5839529,29.882 8.5839529,27.736771 11.265565,27.736771 11.265565,25.590239 0,25.590239z M29.967411,3.9921243L29.967411,8.1359167 25.823251,8.1359167 25.823251,10.100034 29.967411,10.100034 29.967411,14.243865 31.931586,14.243865 31.931586,10.100034 36.075645,10.100034 36.075645,8.1359167 31.931586,8.1359167 31.931586,3.9921243z M30.948448,0C35.985142,1.0841802E-08 40.067997,4.0825729 40.067997,9.1171007 40.067997,14.153367 35.985142,18.236 30.948448,18.236 25.912456,18.236 21.830998,14.153367 21.830998,9.1171007 21.830998,4.0825729 25.912456,1.0841802E-08 30.948448,0z" Stretch="Uniform" Fill="#FF666666" Width="26" Height="26" Margin="0,0,0,0" RenderTransformOrigin="0.5,0.5">
<Path.RenderTransform>
<TransformGroup>
<TransformGroup.Children>
<RotateTransform Angle="0" />
<ScaleTransform ScaleX="1" ScaleY="1" />
</TransformGroup.Children>
</TransformGroup>
</Path.RenderTransform>
</Path>
</Grid>
</Viewbox>
여기서 문제는 다음과 같이 나는 다음 내 텍스트에 이미지와 버튼을 생성하고 있다는 것입니다 :
<corecontrols:IdyllicButton Name="btnClose" Height="30">
<StackPanel Orientation="Horizontal">
<Image Source="/MHA.Modules.PolicyAdmin;component/Images/Cancel.png"/>
<TextBlock VerticalAlignment="Center" Margin="5,0" Text="Close"/>
</StackPanel>
</corecontrols:IdyllicButton>
을하지만 설정할 수 없습니다 내 내가 같은 ResourceDictionary
에서 만든 내 StaticResource
에 Image.ImageSource
다음 오류가 발생합니다.
An object of the type "System.Windows.Controls.Viewbox" cannot be applied to a property that expects the type "System.Windows.Media.ImageSource".
나는 또한 캔버스를 사용해 보았습니다.
아이디어가 있습니까?
내가 대신 Image
를 사용하는의 Viewbox
리소스에 OpacityMask
을 그 자리에 Rectangle
컨트롤을 사용하여 설정하고, 해결책을 발견
내가 필요 없다고 생각합니다 당신은 직접 StackPanel 내에 뷰 박스를 추가 할 수 있습니다 –
이미지 소스로 사용하려면, 내보내기 버튼 (Metro 스튜디오)을 클릭하면 포맷과 파일 이름을 묻습니다 png로 저장하십시오 . –