3
<TextBox Text="{Binding Path=ScalingFactor, Mode=TwoWay, StringFormat=F5}" Grid.Row="0" Grid.Column="0" HorizontalAlignment="Left" Width="150" behaviors:TextBoxBehavior.SelectAllTextOnFocus="True" behaviors:InputBindingsManager.SourceProperty="TextBox.Text"/>
<Button Command="{Binding MultiplyCommand}" Grid.Row="0" Grid.Column="1"
HorizontalAlignment="Center"
Margin="{StaticResource MarginItemLeft}">
<Image Source="/Themes;component/BaseTheme/Images/Add.png" Stretch="None" />
</Button>
<Button Command="{Binding DivideCommand}" Grid.Row="0" Grid.Column="2"
HorizontalAlignment="Center"
Margin="{StaticResource MarginItemLeft}">
<Image Source="/Themes;component/BaseTheme/Images/Minus.png" Stretch="None" />
</Button>
有兩個命令,
因爲這真的看起來像DoubleUpDown從WPF擴展工具套件我想用它代替所有這些代碼的文本框中。
但是我找不到任何有關如何綁定命令的文檔?
你能幫我連接multiplyCommand到上鍵和DivideCommand到下鍵嗎?WPF DoubleUpDown命令我結合上下按鈕
您需要創建從TextBox派生的自定義控件,然後纔可以修改該控件的ControlTemplate。在控制模板中添加向上和向下按鈕。在自定義控件中,您可以處理可以作爲命令公開的按鍵事件和按鍵事件。 – 2015-03-18 21:54:20
@Ganesh我不想繼承TextBox,我想使用WPF擴展工具包。不創建自定義控件 – Gilad 2015-03-18 22:05:42
您能否提供更多關於您想要做什麼的信息?我很難理解這個問題。你想用這個模板替換WPF的模板嗎? – 2015-03-18 22:32:29