내 질문 편집 :UWP XAML ImageBrush.imageSource from networkshare
나는 배열의 단추가있는 스택 패널을 가지고 있습니다. 이제 Networkshare 이미지에서 단추 배경을 설정하고 싶습니다. 여기
내 소스 코드를 인도 표준시 :XAML :
<Page
x:Class="App4.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:App4"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d" Height="1205.722" Width="2045.722">
<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}" Margin="0,0,0,0">
<StackPanel x:Name="sp" HorizontalAlignment="Left" Height="1070" Margin="10,10,0,0" VerticalAlignment="Top" Width="145" Padding="0" CornerRadius="10" RequestedTheme="Light" ScrollViewer.HorizontalScrollBarVisibility="Visible" Grid.RowSpan="2">
<FlyoutBase.AttachedFlyout>
<MenuFlyout/>
</FlyoutBase.AttachedFlyout>
</StackPanel>
</Grid>
코드 뒤에
:
private void onLoad()
{
for (int i = 0; i < imgNames.Length; ++i)
{
ImageBrush brush1 = new ImageBrush();
brush1.ImageSource = new BitmapImage(new Uri("ms-appx:///assets/" + imgNames[i]));
Button button = new Button()
{
Content = string.Format(""),
Tag = i
};
button.Width = 100;
button.Height = 100;
button.Background = brush1;
button.Margin = new Thickness(0, 20, 0, 0);
button.Click += new RoutedEventHandler(button_Click);
this.sp.Children.Add(button);
}
}
감사 네트워크 SOU에서 로딩 이미지
당신은 이미지 브러시없는 이미지를 사용으로 볼의
3) 주 코드 ????? –
죄송합니다. 내 질문을 업데이트했습니다. – silazzz
네트워크 위치에서 버튼 배경을 바꿀 방법을 모은 샘플을 만들었습니다. 곧 링크를 공유 할 것입니다 ..... –