尝试从usercontrol获取属性
This commit is contained in:
@@ -8,7 +8,7 @@
|
||||
mc:Ignorable="d"
|
||||
>
|
||||
<WrapPanel HorizontalAlignment="Center" VerticalAlignment="Top">
|
||||
<ListBox x:Name="IconfontList" ItemsSource="{Binding}" BorderThickness="0" Background="AliceBlue">
|
||||
<ListBox x:Name="IconListBox" ItemsSource="{Binding iconListSystem}" SelectionChanged="ListBox_SelectionChanged" BorderThickness="0" Background="AliceBlue">
|
||||
<ListBox.ItemsPanel>
|
||||
<ItemsPanelTemplate>
|
||||
<WrapPanel Orientation="Horizontal" Background="Transparent"/>
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using GeekDesk.ViewModel;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
@@ -25,5 +26,37 @@ namespace GeekDesk.Control.UserControls.IconFont
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty IconfontListProperty = DependencyProperty.Register("IconfontList", typeof(List<IconfontInfo>), typeof(IconPannel));
|
||||
public List<IconfontInfo> IconfontList
|
||||
{
|
||||
get
|
||||
{
|
||||
return (List<IconfontInfo>)GetValue(IconfontListProperty);
|
||||
}
|
||||
set
|
||||
{
|
||||
SetValue(IconfontListProperty, true);
|
||||
}
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty IconInfoProperty = DependencyProperty.Register("IconInfo", typeof(IconfontInfo), typeof(IconPannel));
|
||||
|
||||
public IconfontInfo IconInfo
|
||||
{
|
||||
get
|
||||
{
|
||||
return (IconfontInfo)GetValue(IconInfoProperty);
|
||||
}
|
||||
set
|
||||
{
|
||||
SetValue(IconInfoProperty, true);
|
||||
}
|
||||
}
|
||||
|
||||
private void ListBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||
{
|
||||
IconfontInfo info = IconfontList[IconListBox.SelectedIndex];
|
||||
IconInfo = info;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user