使用ElementFlow面板显示元素列表
来源:互联网 发布:破解别人的网络摄像头 编辑:程序博客网 时间:2024/06/09 03:01
在CodePlex网站里,有一个很有意思的WPF开源类库可供大家下载和使用,FluidKit。里面包含的ElementFlow面板提供了非常酷的元素列表显示效果:
使用方法也蛮简单的,在Xaml里面,你只要将你想要用ElementFlow显示的元素列表绑定到ItemsControl控件,将ItemsControl的ItemsPanel设置为我们的ElementFlow面板即可,请参考下面的Xaml代码:
<ItemsControl x:Name="_itemsControl"
ItemsSource="{Binding}"
MouseDoubleClick="Image_MouseDoubleClick"
ItemTemplate="{StaticResource TestDataTemplate_Reflection}"
Width="800"
Height="550">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<Controls:ElementFlow Focusable="True"
ElementWidth="400"
ElementHeight="600"
HasReflection="False"
Background="Black">
<Controls:ElementFlow.Camera>
<PerspectiveCamera FieldOfView="60"
Position="0,1,4"
LookDirection="0,-1,-4"
UpDirection="0,1,0" />
</Controls:ElementFlow.Camera>
</Controls:ElementFlow>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
</ItemsControl>
另外,ElementFlow面板还提供了多种列表元素显示视图可供选择,你可以通过C#代码或者Xaml自己设置,下面是C#代码的例子:
private ElementFlow m_ElementFlow;
private Dictionary<string, ViewStateBase> m_ViewStates = new Dictionary<string, ViewStateBase>();
public ElementFlowPage()
{
InitializeComponent();
m_ViewStates.Add("CoverFlow", new CoverFlow());
m_ViewStates.Add("Carousel", new Carousel());
m_ViewStates.Add("TimeMachine2", new TimeMachine2());
m_ViewStates.Add("TimeMachine", new TimeMachine());
m_ViewStates.Add("ThreeLane", new ThreeLane());
m_ViewStates.Add("VForm", new VForm());
m_ViewStates.Add("RollerCoaster", new RollerCoaster());
m_ViewStates.Add("Rolodex", new Rolodex());
}
private void Page_Loaded(object sender, RoutedEventArgs e)
{
_itemsControl.ItemsSource = Directory.GetFiles(Environment.CurrentDirectory + @"/CoolImage", "*.jpg");
DependencyObject obj = VisualTreeHelper.GetChild(_itemsControl, 0);
while ((obj is ElementFlow) == false)
{
obj = VisualTreeHelper.GetChild(obj, 0);
}
m_ElementFlow = obj as ElementFlow;
m_ElementFlow.CurrentView = new TimeMachine();
m_EffectList.MouseDoubleClick += new MouseButtonEventHandler(ListBoxItem_MouseDownClick);
}
private void ListBoxItem_MouseDownClick(object sender, MouseButtonEventArgs e)
{
ListBox lb = sender as ListBox;
ListBoxItem item = FindAnscetor(lb.InputHitTest(e.GetPosition(lb)) as DependencyObject, typeof(ListBoxItem)) as ListBoxItem;
if (item == null)
return;
string key = item.Tag as string;
if (m_ViewStates.ContainsKey(key))
m_ElementFlow.CurrentView = m_ViewStates[key];
}
有兴趣的话可以通过下面这个链接下载到最新的Fluidkit源代码。
http://www.codeplex.com/fluidkit
- 使用ElementFlow面板显示元素列表
- 前端定位 元素 列表显示
- OpenGL 使用显示列表
- 使用ListFragment显示列表
- 伪列表元素点击后高亮显示方法
- 滚动显示面板和滚动条的简单使用实例
- 使用下拉列表显示图片
- 使用批处理列表显示文件
- 使用ExpandableListActivity显示扩展列表
- 使用ListView显示信息列表
- 使用ListView显示信息列表
- 学习使用ListView显示列表
- 使用ListView显示信息列表
- Android | 使用RecyclerView显示列表
- 使用代码删除列表元素.doc
- 使用javascript绘制页面元素-->数据列表
- 顶部隐藏/显示面板
- 显示输入法面板
- Awk 实例
- 通过设置ime-mode在页面输入控件中关闭输入法
- 学习生活小结 -- W70 D2
- 关于23种设计模式的有趣见解
- 炫姐姐给版友的建议:如何和猎头打交道
- 使用ElementFlow面板显示元素列表
- 白话什么是多线程?
- 决定回到这里来,这里放点技术文章吧。
- 等...老公...
- 大型网站架构演变和知识体系
- 复合类型数据
- 教你短信和女生说话的24句
- 如何改变链接的鼠标形状
- 构造器调用顺序