Home Forums WPF controls Xceed Toolkit Plus for WPF How to set size and location of ViewTemplate?

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • User (Old forums)
    Member
    Post count: 23064
    #41785 |
    I’ve managed to create new ViewTemplates thanks to Fawzi[Xceed].
    What I have:
    public DataTemplate SearchViewTemplate
    {
       get;
       set;
    }
    <avalonDock:DockingManager.LayoutItemTemplateSelector>
       <local:PanesTemplateSelector>                    
          <local:PanesTemplateSelector.SearchViewTemplate>
             <DataTemplate>
                 <local:SearchUserControl/>                            
                 </DataTemplate>
             </local:PanesTemplateSelector.SearchViewTemplate>
          </local:PanesTemplateSelector>
    </avalonDock:DockingManager.LayoutItemTemplateSelector>
    My SearchUserControl:
    <UserControl x:Class=”AvalonDock.MVVMTestApp.SearchUserControl”
                 <!–The code omitted the brebity–>
                 Height=”100″ Width=”100″ Background=”Azure”>
           <StackPanel>
              <TextBlock Text=”Введите искомое слово:”/>
              <TextBox MinWidth=”100″ Margin=”5″ VerticalAlignment=”Top”/>
           </StackPanel>
    </UserControl>
    My questins are:
    1. How to set size for the SearchViewTemplate?  (I’ve set size to <UserControl Height=”100″ Width=”100″ Background=”Azure”/> However, I just see the smaller blue Searchwindow in big white SearchViewTemplate)
    2. How to set location where SearchViewTemplate will be shown? (In my application SearchViewTemplate is always shown at the left side, but I would like to show at the right bottom side)
     
    I’ve attached the application to the topic. 

    Imported from legacy forums. Posted by Stepan (had 179 views)

    Fawzi [Xceed]
    Member
    Post count: 722
    Hi Stepan,

    In regards to the size of the SearchViewTemplate, when you use DockingManager.AnchorablesSource, an Horizontal  LayoutAnchorablePane will be created internally to add the LayoutAnchorableItems into it. It’s default DockWidth will be 200. You can see it in file : 
    -Xceed.Wpf.AvalonDock/DockingManager.cs
    in method : anchorablesSourceElementsChanged.

    You can change this default width. For clear result, try running your app with the file “AvalonDock.config” deleted.

    But keep in mind that when docked to right of left, the Height will be using all the vertical available space from the DockingManager. When docked on top or bottom, the Width will be using all the horizontal available space from DockingManager. So it is normal if your DockingManager is big and your SearchViewTemplate is small that you see a lot of white.

    Now regarding your second question to set location of SearchViewTemplate, if you drag your LayoutAnchorablePane, the available drop position will be left/top/right/bottom/center (like the windows in Visual Studio). You can not position it in the bottom right corner.

    Imported from legacy forums. Posted by Fawzi [Xceed] (had 27 views)

    User (Old forums)
    Member
    Post count: 23064

    Hi Fawzi,

    1. I am sorry but I know that I am dummy. I could not find method AnchorablesSourceElementsChanged” at DockingManager.cs. I’ve tried to write at the constructor of SearchViewModel:

    DockingManager dm = new DockingManager() {Width=5000 };

    but there is no result. The size of SearchViewmodel is not changed.

    2. Am I right that I wrote code at the constructor of SearchViewModel to define desired size of SearchViewTemplate?

    3. Regarding my second question to set location, you really have given me a good answer. Thanks. 

     

    Imported from legacy forums. Posted by Stepan (had 76 views)

    Fawzi [Xceed]
    Member
    Post count: 722
    Hi Stepan,
    You need to have access to the source files in order to look in file DockingManager.cs. “anchorablesSourceElementsChanged” which is not a public method.
    If you can’t find it, you can do the following in your method MainWindow.MainWindow_Loaded:
    var pane = dockManager.Layout.Descendents().FirstOrDefault( x => x.GetType() == typeof( LayoutAnchorablePane ) );
    ((LayoutAnchorablePane)pane).DockWidth = new GridLength(100);
    This will find the LayoutAnchorablePane holding the FileStats and Search templates. It will then set its DockWidth to 100 pixels.

    Imported from legacy forums. Posted by Fawzi [Xceed] (had 162 views)

    User (Old forums)
    Member
    Post count: 23064

    Fawzi, I would like ask you more about the second question:

    I’ve
    managed to create new VeiwTemplate called FeatureViewTemplate. Special thanks
    to you, Fawzi [Xceed]. 
    At start of
    the program I always see my FeatureViewTemplate is show at the right side
    within FileStatsViewTemplate like that:
     enter image description here 

    But
    I would like the arrange of areas
      in
    such order File Stats at the left side and the FeatureArea at the Right side.
    Like that:
     

    enter image description here 

    But I really would like to show a such order at the start of program when AvalonDock.config is not created by AvalonDock.MVVMTestApp application. Please, help me Fawzi[Xceed] .

    Imported from legacy forums. Posted by Stepan (had 0 views)

Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.