MikeI
New member
- Joined
- Jul 1, 2021
- Messages
- 2
- Programming Experience
- 1-3
I have a question about WPF. The interface shown in the GIF is something written in C++. I've been trying to replicate this effect for some time, but with no success.
What I've been trying to do is create a trigger to give the grid column definition a width of "*" instead of the regular "4*" when the width of the column is lower than 300. Is there a better way to look into/research on achieving this effect?
Basically, prioritizing the resize of the first grid column before any other grid column gets resized is what I'm trying to do.
What I've been trying to do is create a trigger to give the grid column definition a width of "*" instead of the regular "4*" when the width of the column is lower than 300. Is there a better way to look into/research on achieving this effect?
Grid:
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="auto" />
<RowDefinition Height="auto" />
<RowDefinition Height="auto" />
<RowDefinition Height="auto" />
<RowDefinition Height="auto" />
</Grid.RowDefinitions>
<Expander Name="anExpander"
Grid.Row="0"
VerticalAlignment="Top"
Header="General"
IsExpanded="True">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="4*" >
<ColumnDefinition.Style>
<Style>
<Style.Triggers>
<DataTrigger
Binding="{Binding Path=ColumnDefinition.Width, RelativeSource={RelativeSource Self},Converter={StaticResource CutOffConverter}}" Value="False">
<Setter Property="{Binding Path=ColumnDefinition.Width}" Value="*" />
</DataTrigger>
</Style.Triggers>
</Style>
</ColumnDefinition.Style>
</ColumnDefinition>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" MinWidth="10"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="32" />
<RowDefinition Height="32" />
<RowDefinition Height="32" />
<RowDefinition Height="32" />
<RowDefinition Height="32" />
</Grid.RowDefinitions>
<Label
Grid.Row="0"
Grid.Column="0"
VerticalAlignment="Bottom"
Content="Name" />
<TextBox
x:Name="Name"
Grid.Row="0"
Grid.Column="1"
Grid.ColumnSpan="4"
Margin="2,5,5,2"
HorizontalAlignment="Stretch"
HorizontalContentAlignment="Left"
Text="{Binding Name, Mode=TwoWay}">
</TextBox>
<Label
Grid.Row="1"
Grid.Column="0"
VerticalAlignment="Bottom"
Content="Profile" />
<ComboBox
x:Name="profile"
Grid.Row="1"
Grid.Column="1"
Grid.ColumnSpan="3"
Margin="2,5,5,2"
HorizontalAlignment="Stretch"
HorizontalContentAlignment="Left"
IsEditable="True"
ItemsSource="{Binding ProfileCatalog}"
SelectedItem="{Binding Profile, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
<Button
x:Name="profileCatalog"
Grid.Row="1"
Grid.Column="4"
Margin="2,5,0,2"
HorizontalAlignment="Stretch"
HorizontalContentAlignment="Center"
MinWidth="15"
MaxWidth="35"
Command="{ui:CommandHandler ProfileCatalogClick}"
Content="...">
</Button>
</Grid>
</Expander>
</Grid>
Basically, prioritizing the resize of the first grid column before any other grid column gets resized is what I'm trying to do.
Last edited: