English 中文(简体)
ComboB Whitoxh
原标题:ComboBox Whith a TreeView

I need to create a userControl like a Combobox. In the items in need a TreeView and a Button. If I navigate the Tree the Item should go to the Text Box in the Bottom. If I click the Button the Tree should Collapsed. My First idea was like This but it isn t good.

    <StackPanel Orientation="Vertical">
        <StackPanel  Orientation="Horizontal">
            <TextBox Text="{Binding Adresse, Mode=TwoWay}" MaxLength="50" MinWidth="170" Grid.Row="5" Margin="5,2,5,2"/>
            <Button  Width="25" Margin="2"  Click="Down">
                <Image Source="/C1_net;component/Images/arrow.jpg" HorizontalAlignment="Left" />
            </Button>               

        </StackPanel>
        <StackPanel x:Name="Tree"  Orientation="Vertical" Visibility="Collapsed">                
            <sdk:TreeView Height="200" Name="treeView1" Width="200" />
            <Button Content="{Binding Path=ApplicationStrings.OKButton, Source={StaticResource ResourceWrapper}}" Width="75" Margin="5" Click="OnOk" HorizontalAlignment="Right"/>

        </StackPanel>

    </StackPanel>

</Grid>

If I switch to Visible the Control needs more space. So I need to bring the Tree in Front of the Rest of the Window. Any ideas?

最佳回答

Ok.

我认为,你应当重新讨论你们的交流。

my problemm wase to think if i select i Item, The Tree wood be closed. I will navigate in a Hirarchical DataObjekt and Put the Path as selectet Item. So now I will to somting like this:

public interface ITreeViewItemModel
{
    string SelectedValuePath { get; }

    bool IsExpanded { get; set; }

    bool IsSelected { get; set; }

    IEnumerable<ITreeViewItemModel> GetHierarchy();
    IEnumerable<string> GetDisplayHierarchy();
    IEnumerable<ITreeViewItemModel> GetChildren();
}

页: 1

public class ComboBoxTreeView : ComboBox
{
    private ExtendedTreeView _treeView;
    private ContentPresenter _contentPresenter;

    public ComboBoxTreeView()
    {
        this.DefaultStyleKey = typeof(ComboBoxTreeView);
    }

......

见http://vortexwolf.wordpress.com/204/29/silverlight-combo Box-with-treeview-inside/“rel=“nofollow”http://vortexwolf.wordpress.com/04/29/silverlight-combo Box-with-treeview-inside/

问题回答

暂无回答




相关问题
WPF Datagrid, Setting the background of combox popup

I would like to change the color of the popup background when using a DatagridComboboxColumn in the WPF Toolkit datagrid. I ve edited the Template for a normal Combobox and it works great for selected ...

How to insert ComboBox item into ListBox? [winforms]

The question is very simple, How to insert ComboBox selected item into ListBox using c#? I have tried with this: listbox.Items.Add(combobox.SelectedItem); and some other permutations but it always ...

How do I bind a ComboBox to a one column list

I ve seen how to bind a ComboBox to a list that has columns like this: ItemsSource="{Binding Path=Entries}" DisplayMemberPath="Name" SelectedValuePath="Name" SelectedValue="{Binding Path=Entry}" But ...

Wpf Combobox Limit to List

We are using Wpf Combobox to allow the user to do the following things: 1) select items by typing in the first few characters 2) auto complete the entry by filtering the list 3) suggesting the first ...

热门标签