3列の単純なグリッドがあります
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="{Binding NavigationWidth}" />
<ColumnDefinition Width="4" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
</Grid.ColumnDefinitions>
</Grid>
<GridSplitter Grid.Column="1" Grid.Row="2"
ResizeDirection="Columns"
Background="Silver"
Width="2" HorizontalAlignment="Center"
VerticalAlignment="Stretch" />
<ContentControl x:Name="navigationView" Grid.Column="0" Grid.Row="1"/>
<ContentControl x:Name="workspaceView" Grid.Column="2" Grid.Row="1" />
// The NavigationWidth is belongs to the ViewModel
public int NavigationWidth
{
get{ return _navigationWidth; }
set{
_navigationWidth = value;
OnPropertyChanged("NavigationWidth");
}
}
したがって、上記の設定に基づいて、ユーザーのナビゲーション先に応じて、コードはグリッドの最初の列の幅を設定しようとします。ユーザーが幅を手動で変更しなければ、すべて正常に機能します。
ユーザーが設定した幅をコードが上書きできる方法はありますか?
ありがとう、
オースティン