开发者

UserControl (Add listview GridViewColumn from another user control)

I want to add a GridViewColumn to a ListView which resides in a UserControl from another Windows screen (Parent).

Example:

<UserControl x:Class="ListViewUserControl"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      开发者_StackOverflow中文版       xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             Height="100" Width="300">
    <Canvas>
        <StackPanel Height="100" Width="300" Name="listViewHolder">
            <ListView Name="LstView"/>
        </StackPanel>
    </Canvas>
</UserControl>

I want to use this user control in Windows.

How can I change the ListView Style, ItemContainerStyle, or add GridViewColumn?

<Window x:Class="WpfApplicationListView.Window2"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="Window2" Height="470" Width="882">
    <Canvas>
        <my1:ListViewNavigation Name="navCtrl"
                                xmlns:my1="clr-namespace:UsrControls;assembly=UsrControls"
                                Canvas.Left="0" Canvas.Top="0" Height="233" Width="493">
        </my1:ListViewNavigation>
    </Canvas>
</Window>

Please let me know is there any other way to design this scenario.

Regards,

Jegan


We can use dependency property to pass the property to child controls...

Regards Jegan

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜