我的WPF应用程序有一个我在混合上构建的样式管理器.
我的问题是:我有一个偶尔闪烁的登录按钮,我无法弄清楚如何删除此行为.
这是我的登录框的样式代码:
<Style x:Key="LoginBoxGrid" TargetType="{x:Type Grid}">
<Setter Property="Background">
<Setter.Value>
<ImageBrush ImageSource="/Client;component/Assets/images/LoginBox.png" Stretch="None" TileMode="Tile"/>
</Setter.Value>
</Setter>
<Setter Property="Opacity" Value="0.765"/>
<Setter Property="Width" Value="411"/>
<Setter Property="HorizontalAlignment" Value="Left"/>
<Setter Property="Margin" Value="126,150,0,111"/>
</Style>
<Style x:Key="LoginBoxHeader" TargetType="{x:Type Label}">
<Setter Property="Grid.Column" Value="2"/>
<Setter Property="Margin" Value="-16.183,18.347,0,0"/>
<Setter Property="Width" Value="64.994"/>
<Setter Property="FontSize" Value="16"/>
<Setter Property="FontWeight" Value="Bold"/>
<Setter Property="FontStyle" Value="Italic"/>
<Setter Property="Foreground" Value="White"/>
<Setter Property="VerticalAlignment" Value="Top"/>
<Setter Property="HorizontalAlignment" Value="Left"/>
<Setter Property="FontFamily" Value="/Client;component/Assets/Fonts/#Arial Black"/>
</Style>
<Style x:Key="LoginBtn" TargetType="{x:Type Button}">
<Setter Property="Grid.Column" Value="2"/>
<Setter Property="Margin" Value="16.6,9.022,9.282,8"/>
<Setter Property="Grid.Row" Value="4"/>
<Setter Property="Width" …Run Code Online (Sandbox Code Playgroud) 我想借助滑块在画布上调整一个圆圈.这个圆圈可以通过我在代码后面做的一些拖放操作在画布上移动,所以它的位置不固定.
我将滑块的值绑定到椭圆的高度和宽度.不幸的是,当我使用滑块时,圆圈的左上角点(实际上是它所在的矩形的左上角)在操作过程中保持不变.
我希望在操作期间使其中心点保持不变来调整它的大小.在XAML中有一个简单的方法吗?顺便说一下,我已经尝试过ScaleTransform,但它并没有完全按我的意愿行事.
谢谢你!:-)
一月
<Canvas x:Name="MyCanvas">
<!-- this is needed for some adorner stuff I do in code behind -->
<AdornerDecorator Canvas.Left="10"
Canvas.Top="10">
<Ellipse x:Name="myEllipse"
Height="{Binding Path=Value, ElementName=mySlider}"
Width="{Binding Path=Value, ElementName=mySlider}"
Stroke="Aquamarine"
Fill="AliceBlue"
RenderTransformOrigin="0.5 0.5">
<Ellipse.RenderTransform>
<RotateTransform Angle="{Binding Path=Value, ElementName=myRotationSlider}" />
</Ellipse.RenderTransform>
</Ellipse>
</AdornerDecorator>
<Slider x:Name="mySlider"
Maximum="100"
Minimum="0"
Width="100"
Value="10"
Canvas.Left="150"
Canvas.Top="10" />
<Slider x:Name="myRotationSlider"
Maximum="360"
Minimum="0"
Width="100"
Value="0"
Canvas.Left="150"
Canvas.Top="50" />
</Canvas>
Run Code Online (Sandbox Code Playgroud) 我目前正在构建一个将用于触摸屏的UI.因此,我想将任何RadioButton组显示为ToggleButtons的水平行.我已经想出了如何显示ToggleButtons而不是标准项目符号:
<Style x:Key="{x:Type RadioButton}"
TargetType="{x:Type RadioButton}"
BasedOn="{StaticResource {x:Type ToggleButton}}">
Run Code Online (Sandbox Code Playgroud)
但是,这将显示一列 ToggleButtons,而不是一行.你知道一个简单的方法吗?
非常感谢!
我当前正在我的应用程序中显示RadioButtons作为ToggleButtons的行(请参阅我的上一个问题).但是,我希望按钮具有相同的宽度 - 目前,每个按钮都和它一样宽.
因为我正在使用模板,所以我希望每次使用控件时都避免指定宽度 - 相反,行中每个按钮的宽度应该等于该组中最宽按钮的宽度.
有任何想法如何在XAML中做到这一点?:-)