For some reason, ListView goes beyond the form and Scrollbar does not become active: How can I fix? If you put an explicit height, everything works, but when the form is a form, everything looks not very kosher ...
Here is the markup of the form itself:
<
Window X: Class= "DictionaryCreator.ui.Windows.dictionaryConfigurationWindow"
XMLNS= "http://schemas.microsoft.com/winfx/2006/xaml/Presentation"
XMLNS: X= "http://schemas.microsoft.com/winfx/2006/xaml"
XMLNS: D= "http://schemas.microsoft.com/expression/blend/2008"
XMLNS: MC= "http://schemas.openxmlformats.org/markup-compatibility/2006"
XMLNS: Local= "CLR-Namespace: dictionarycreator.ui.Windows"
XMLNS: B= "http://schemas.microsoft.com/xaml/behaviors"
MC: IGNORABLE= "D"
Title= "Handbook configuration" sizetocontent= "height" width= "1200" >
≪
Window.Inputbindings >
≪
KeyBinding Command= "{Binding CancelCommand}" Key= "Escape" />
≪
/Window.inputbindings>
≪
Grid grid.issharedsizescope= "True" >
≪
Grid.resources >
≪
STYLE TARGETTYPE= "BORDER" >
≪
Setter property= "padding" value= "5,5,5,5" />
≪
/STYLE >
≪
/Grid.resources>
≪
Grid.RowDefinitions >
≪
RowDefinition Height= "AUTO" >
≪
/RowDefinition >
≪
RowDefinition Height= "*" >
≪
/RowDefinition >
≪
RowDefinition Height= "AUTO" >
≪
/RowDefinition >
≪
/Grid.RowDefinitions&gT;
≪
Grid grid.row= "0" columnspan= "2" dataconfigvm {binding DICTCONFIGVM} ">
≪
Grid.columndefinitions >
≪
Columndefinition >
≪
/Columndefinition >
≪
Columndefinition >
≪
/Columndefinition >
≪
Columndefinition width= "auto" sharedsizegroup= "buttonwidth" >
≪
/Columndefinition >
≪
/Grid.columndefinitions&gT;
≪
Grid.RowDefinitions >
≪
RowDefinition Height= "AUTO" >
≪
/RowDefinition >
≪
RowDefinition Height= "AUTO" >
≪
/RowDefinition >
≪
RowDefinition Height= "AUTO" >
≪
/RowDefinition >
≪
RowDefinition Height= "AUTO" >
≪
/RowDefinition >
≪
RowDefinition Height= "AUTO" >
≪
/RowDefinition >
≪
RowDefinition Height= "AUTO" >
≪
/RowDefinition >
≪
/Grid.RowDefinitions&gT;
≪
Border Grid.Row= "0" grid.column= "0" >
≪
Label horizontalcontentalignment= "right" >
Database type <
/Label >
≪
/Border >
≪
Border grid.row= "0" grid.column= "1" >
≪
ComboBox Itemssource= "{binding path= dbkinds}" displaymemberpath= "name" selectedvalue= "{binding path= selecteddbkind}" />
≪
/Border >
≪
Border grid.row= "1" grid.column= "0" >
≪
Label horizontalcontentalignment= "right" >
Server (MSSQL) or file path (MS Access) <
/Label >
≪
/Border >
≪
Border Grid.Row= "1" grid.column= "1" >
≪
TextBox text= "{binding path= filepathorservername, updatesourcetrigger= propertychanged}" />
≪
/Border >
≪
Border Grid.Row= "2" grid.column= "0" >
≪
Label horizontalcontentalignment= "right" >
Database name <
/Label >
≪
/Border >
≪
Border Grid.Row= "2" grid.column= "1" >
≪TextBox iSeNabled= "{binding path= dbnameenable}" text= "{binding path= dbname, updatesourcetrigger= propertychanged}" > <
/TextBox >
≪
/Border >
≪
Border grid.row= "3" >
≪
Label horizontalcontentalignment= "right" >
Table name <
/Label >
≪
/Border >
≪
Border grid.row= "3" grid.column= "1" >
≪
ComboBox DockPanel.Dock= "Left" minwidth= "350" itemssource= "{binding path= tabledescripts}" selectedvalue= "{binding path= selectedtabledescription}" >
≪
ComboBox.ItemTemplate >
≪
DATATEMPLATE >
≪
TextBlock >
≪
Run Text= "{Binding Schema}" />
≪
Run Text= "." /≫
≪
Run Text= "{Binding Tablename}" />
≪
/TextBlock >
≪
/DATATEMPLATE >
≪
/Combobox.itemtemplate>
≪
/ComboBox >
≪
/Border >
≪
Border Grid.Row= "3" grid.column= "2" >
≪
Button dockpanel.dock= "Right" Command= "{binding path= refreshtablescommand}" >
≪
Image style= "{staticResource ImageIcon}" source= "../icons /refresh.png" />
≪
Button.Tooltip >
Refresh
≪
/Button.ToolTip>
≪
/Button >
≪
/Border >
≪
Border grid.row= "4" >
≪
Label horizontalcontentalignment= "right" >
Table key (integer) <
/Label >
≪
/Border >
≪
Border grid.row= "4" grid.column= "1" >
≪
TextBox Text= "{binding path= selectedKeycolumndescription.columnname, Mode= TwoWay}"
Isreadonly= "True" focusable= "false" />
≪
/Border >
≪
Border grid.row= "5" >
≪
Label horizontalcontentalignment= "right" >
Field name for normalized value <
/Label >
≪
/Border >
≪
Border grid.row= "5" grid.column= "1" >
≪
ComboBox itemssource= "{binding path= columndescripts}" displaymemberpath= "columnname" selectedvalue= "{binding path= selectedfulltextcolumndescript}" >
≪
/ComboBox >
≪
/Border >
≪
/Grid >
≪
Grid grid.row= "1" grid.column= "0" >
≪
Grid.columndefinitions >
≪
Columndefinition />
≪
! -We put an empty column of the same size as from above ->
≪
Columndefinition width= "auto" sharedsizegroup= "buttonwidth" />
≪
/Grid.columndefinitions&gT;
≪
Grid.RowDefinitions >
≪
RowDefinition Height= "AUTO" >
≪
/RowDefinition >
≪
/Grid.RowDefinitions&gT;
≪
Border Grid.ROW= "0" grid.column= "0" margin= "0.0, -10.0" >
≪
Groupbox datactext= "{binding algorithmconfigvm}" >
≪
Groupbox.Header >
Setting up algorithm
≪
/Groupbox.header>
≪
Border >
≪
StackPanel >
≪
ComboBox ItemSSOURCE= "{Binding NormalizeServices}" selectedItem= "{binding selectednormalizervice}" displaymemberpath= "normalizealgorithmtype.name" />
≪
Border >
≪
StackPanel >
≪
Label >
Parameters algorithm <
/Label >≪ listview maxheight= "250" itemssource= "{binding params}" >
≪
ListView.ItemTemplate >
≪
DATATEMPLATE >
≪
Grid >
≪
Grid.columndefinitions >
≪
Columndefinition />
≪
Columndefinition />
≪
/Grid.columndefinitions&gT;
≪
Grid.RowDefinitions >
≪
RowDefinition Height= "*" >
≪
/RowDefinition >
≪
/Grid.RowDefinitions&gT;
≪
Label grid.column= "0" CONTENT= "{Binding Item.Name}" >
≪
/Label >
≪
TextBox grid.column= "1" text= "{binding value}" >
≪
/TextBox >
≪
/Grid >
≪
/DATATEMPLATE >
≪
/ListView.itemTemplate&gT;
≪
/ListView >
≪
/Stackpanel >
≪
/Border >
≪
Border >
≪
StackPanel >
≪
Label >
Setting the layout results < bindings;
/Label >
≪
ListView itemssource= "{binding fieldbindings}" selecteditem= "{binding selectedbinding}" scrollviewer.verticalscrollbarvisibility= "visible" horizontalcontentalignment= "Stretch" >
≪
ListView.ItemTemplate >
≪
DATATEMPLATE >
≪
Grid >
≪
Grid.columndefinitions >
≪
Columndefinition >
≪
/Columndefinition >
≪
Columndefinition >
≪
/Columndefinition >
≪
/Grid.columndefinitions&gT;
≪
Grid.RowDefinitions >
≪
RowDefinition Height= "*" >
≪
/RowDefinition >
≪
/Grid.RowDefinitions&gT;
≪
Label grid.column= "0" horizontalignment= "straightch" horizontalcontentalignment= "Stretch" >
≪
Textbox isreadonly= "true" horizontalignment= "straightch" horizontalcontentalignment= "straightch" borderthickness= "0" focusable= "false" cursor= "arrow" >
≪
TextBox.Text >
≪
Multibinding StringFormat= "{} {0} ({1})" Mode= "Oneway" >
≪
Binding path= "item.name" />
≪
Binding Path= "Item.Description" />
≪
/Multibinding >
≪
/TextBox.text>
≪
/TextBox >
≪
/Label >≪ combobox grid.column= "1" Itemssource= "{Binding RelativeSource= {RelativeSource Ancestortype= StackPanel},
Path= datactext.availablecolumns} "displaymemberpath="columnname "
Selecteditem= "{binding value}" >
≪
/ComboBox >
≪
/Grid >
≪
/DATATEMPLATE >
≪
/ListView.itemTemplate&gT;
≪
/ListView >
≪
/Stackpanel >
≪
/Border >
≪
/Stackpanel >
≪
/Border >
≪
/Groupbox >
≪
/Border >
≪
/Grid >
≪
Wrappanel grid.row= "2" grid.columnspan= "3" horizontalignment= "center" margin= "0 30 0 25" >
≪
Button Command= "{Binding Path= Savecommand}" margin= "0 0 25 0" >
≪
Button.content >
≪
StackPanel Orientation= "Horizontal" >
≪
Image style= "{staticResource imageonwithmargin}" source= "../icons /save.png" />
≪
Label verticalignment= "center" >
Save <
/Label >
≪
/Stackpanel >
≪
/Button.content>
≪
/Button >
≪
Button Command= "{Binding Path= CancelCommand}" margin= "0 0 25 0" >
≪
Button.content >
≪
StackPanel Orientation= "Horizontal" >
≪
Image style= "{staticResource imageonwithmargin}" source= "../icons /caancel.png" />
≪
Label verticalignment= "center" >
Cancel <
/Label >
≪
/Stackpanel >
≪
/Button.content>
≪
/Button >
≪
/Wrappanel >
≪
/Grid >
≪
/Window >
Marking is strange, why do you need a whole bunch of unnecessary BORDER? Vertical stackpanel also look unnecessary. I would do it all just in the grid on the rows. And why do you continue to use Label? In WPF, this is an absolutely meaningless analogue of ContentControl, to display a simple text you need to take the usual TextBlock, to display complex content -Actually, ContentControl, Label never needed
Андрей NOP2021-04-07 18:38:07@ Andreynop Do you mean ListView put in ScrollViewer? Put it, but something is just as= (
iluxa18102021-04-07 18:40:09Because you have stackpanel, he highlights the control as much space as he wants and it does not matter that there is so much place physically not. You have in the top level grid with three rows, here I would have wrapped the whole content in ScrollViewer
Андрей NOP2021-04-07 18:42:50But for the beginning you can try to wrap in ScrollViewer your stackpanel. In general, in WPF to succeed it is necessary to understand well and feel how they behave any containers, understand how the layout occurs
Андрей NOP2021-04-07 18:44:58- How to make an animation to change the background color from Button WPF c#?
- [c #] [wpf] can a sub-screen (xaml) be created in another project?
- about wpf c # datepicker beginner
- c # - i want to display testxamlcs hanging under testxaml
- about wpf c # datepicker beginner
- c # - read wpf combobox text file
- about wpf c # felica
- write to wpf c # csv file
- write csv using wpf c # where clause
- c # - how to dynamically change text color in xaml
Wrap in ScrollViewer, the place is not enough where he is still ...
Андрей NOP2021-04-07 18:35:22