으로 UserControl 속성을 선언 나는 속성이 내 UserControl을 내가 XAML에서 이것을 사용할 수 있도록하고 싶습니다정적 자원
private StaticInfoCollection _StaticInfoColl;
public StaticInfoCollection StaticInfoColl
{
get { return _StaticInfoColl; }
set
{
if (value == _StaticInfoColl) return;
_StaticInfoColl = value;
}
}
내에서 정의합니다. 내가
<UserControl.Resources>
<local:Static.StaticInfoColl x:Key="SIColl" />
</UserControl.Resources>
XML 네임 스페이스에 존재하지 않는 Static.StaticInfoColl
태그를 다음과 같이 속성을 선언 할 때마다 그러나 clr-namespace:AAA.Presentation
누군가 내가 뭘 잘못에 나를 도울 수 ?
해당 UserControl의 이름 정적 [X : 이름]
<UserControl x:Class="AAA.Presentation.ucBrand"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local ="clr-namespace:MBCL.Presentation"
mc:Ignorable="d"
d:DesignHeight="710"
d:DesignWidth="1025"
Height="710"
Width="1025"
x:Name="Static"
HorizontalAlignment="Left"
HorizontalContentAlignment="Left">
난 그들 복수 버튼 UserControl이있다. 는 다음과 같이 내 버튼은 StackPanel에 있습니다
<Button Style="{StaticResource appViewButton}" DataContext="{Binding}" >
<StackPanel>
<TextBlock FontSize="11">View Products</TextBlock>
<TextBlock Text="{Binding Path=FileDownloadDate,StringFormat='Last Uploaded : {0:dd-MMM-yyyy}'}"
Style="{StaticResource tbUploadDate}"
HorizontalAlignment="Center" />
</StackPanel>
</Button>
내가 엔티티 Info
및 InfoCollection
있습니다.
이 버튼은 FileType을 기반으로 InfoCollection에 바인딩됩니다. 적절한 FileDownloadDate를 선택하고 표시하려고합니다. 내가 제대로 이해하면
public class Info
{
public Info(DataRow dr)
{
_FileType = Util.HandleNull<string>(dr[AppConstants.FILE_TYPE]);
_FileID = Util.HandleNull<long?>(dr[AppConstants.FILEID]);
_FileTypeDesc = Util.HandleNull<string>(dr[AppConstants.CODE_DESC]);
_FileDownloadDate = Util.HandleNull<DateTime>(dr[AppConstants.DOWNLOAD_DATE]);
}
private string _FileType;
public string FileType
{
get { return _FileType; }
set
{
if (value != _FileType)
_FileType = value;
}
}
private string _FileTypeDesc;
public string FileTypeDesc
{
get { return _FileTypeDesc; }
set
{
if (value != _FileTypeDesc)
_FileTypeDesc = value;
}
}
private long? _FileID;
public long? FileID
{
get { return _FileID; }
set
{
if (value != _FileID)
_FileID = value;
}
}
private DateTime _FileDownloadDate;
public DateTime FileDownloadDate
{
get { return _FileDownloadDate; }
set
{
if (value != _FileDownloadDate)
_FileDownloadDate = value;
}
}
}
public class InfoCollection : ObservableCollection<Info>
{
public InfoCollection(DataTable dtStaticInfo)
{
foreach (DataRow drSInfo in dtStaticInfo.Rows)
{
this.Add(new StaticInfo(drSInfo));
}
}
}
포스트 전체'Static' 클래스를. –
그건별로 의미가 없습니다. 이 인스턴스 (및 그 이상)가있는 객체의 인스턴스를 만들 수있는 속성의 인스턴스를 만들 수 없습니다. "UserControl.Resources"섹션은 브러쉬, 애니메이션, 스타일, 템플릿 등과 같이 다른 클래스 나 객체가 컨트롤에 사용할 수 있습니다. 또한 "정적"이란 무엇입니까? 너의 xaml에? 네임 스페이스? 그 별칭은 "local :"입니다. 원하는 것을 자세하게 기재하십시오. – dowhilefor