Current filter:
                                You should refresh the page.
                                0
                                  • Hi,


                                    I'm trying to make the lookup default size bigger than default, but the [LookupDropDownWindowPreferredSize(800, 300)]

                                    attribute does nothing.. how come ?i


                                    here's a sample sln



                                temp.zip
                                • Martin D. 06.23.2012

                                  Maybe it's possible to modify the model on Controller.Update model method ? (can't find any sample how to do that)
                                  Or simply update the template's size property before it's assigned ?

                                You must  log in  or  register  to leave comments

                                1 Solution

                                1

                                It seems that this attribute does not work any longer. We will update our documentation. To accomplish this task, you can update the Model via the controller by assigning the Width and Height properties value of the IModelTemplateWin.FormStates["viewID"] model node as it is shown in the following code snippet:

                                	
                                [C#]
                                ((IModelTemplateWin)Application.Model.Templates[typeof(DevExpress.ExpressApp.Win.Templates.LookupControlTemplate).FullName]).FormStates["YOUR_OBJECT_LookupListView"].Width = "1000";

                                Show all comments
                                • Konstantin M (DevExpress) 06.28.2012

                                  Posted by: Martin D.

                                  Well, can't tell that I get the results expected


                                  Take a look .

                                  The template isn't there :|


                                • Konstantin M (DevExpress) 06.28.2012

                                  Please use the code I provided earlier and do not forget to replace the "YOUR_OBJECT_LookupListView" string with a real lookup list view ID. Let me know if this helps.

                                • Martin D. 06.28.2012

                                  No, it does not.
                                  Gives a null reference exception at the index. Seems to me that it cant find any lookupview templates in the model
                                  Thats why I listed the contents, and it only has 4 temps.
                                  Tried with a new solution, same thing

                                • Konstantin M (DevExpress) 06.28.2012

                                  The Model.Templates and FormStates nodes are null because there is no any customization for this kind of template. In this case, I suggest that you manually add corresponding customization directly into the Model.xafml file. To get the valid xml, you can open a required lookup editor and resize it as you wish. The customization will be written to the Model.User.xafml file after you close the application. After you customize the lookup window size, open ModelEditor from the application and merge generated differences into the Model.xafml file using the Merge Differences button. This approach allows you to set the default size of the window, and it will not be lost if you remove the user differences for the model. If you set size this way, it will be possible to customize size at runtime. Using the code I suggested previously makes the runtime customization impossible. Hope this will help you.

                                • Martin D. 06.28.2012

                                  I would like to stick to the "update from code" and find out why the template is not in the model.
                                  Maybe I can Add it from code ?

                                • Konstantin M (DevExpress) 06.28.2012

                                  Yes, you can add these nodes from code, but in this case your user will not be able to customize the window size.
                                  To add the nodes, you can use the following code:

                                  string templateName = typeof(DevExpress.ExpressApp.Win.Templates.LookupControlTemplate).FullName;
                                              string lookupListViewID = "YOUR_OBJECT_LookupListView";
                                              DevExpress.ExpressApp.Model.IModelTemplate templateModel = Application.Model.Templates[templateName];
                                              if(templateModel == null) {
                                                  templateModel = Application.Model.Templates.AddNode<DevExpress.ExpressApp.Model.IModelTemplate>(templateName);
                                              }
                                              DevExpress.ExpressApp.Model.IModelFormState formState = ((IModelTemplateWin)templateModel).FormStates[lookupListViewID];
                                              if(formState == null) {
                                                  formState = ((IModelTemplateWin)templateModel).FormStates.AddNode<DevExpress.ExpressApp.Model.IModelFormState>(lookupListViewID);
                                              }
                                              formState.Width = "1000";
                                  
                                  This code works fine in my tests. Do not hesitate to contact us in case of any further difficulties.

                                • Martin D. 06.28.2012

                                  Ok. this one works :)
                                  But as You said, it overrides any user customization's done.

                                • Konstantin M (DevExpress) 06.28.2012

                                  In this case, use the Model differences the way I described earlier.

                                You must  log in  or  register  to leave comments
                                You must  log in  or  register  to leave an answer

                                Is your intention to post an answer to your own question?

                                • If so, then proceed.
                                • If you simply wanted to post additional information, ask for further clarification, or to just say "Thanks!", please click Leave a Comment.
                                • If you wish to edit your original question, please use the Edit button in the Toolbox at the top right corner of that entry.