我想ProgressBar
用圆圈替换常规,在镜头搜索后在论坛中我找到了我想要的东西.
CircularProgressBar.XAML
<Grid>
<Path x:Name="pathRoot" Stroke="{Binding SegmentColor, ElementName=userControl}"
StrokeThickness="{Binding StrokeThickness, ElementName=userControl}" HorizontalAlignment="Left" VerticalAlignment="Top">
<Path.Data>
<PathGeometry>
<PathGeometry.Figures>
<PathFigureCollection>
<PathFigure x:Name="pathFigure">
<PathFigure.Segments>
<PathSegmentCollection>
<ArcSegment x:Name="arcSegment" SweepDirection="Clockwise" />
</PathSegmentCollection>
</PathFigure.Segments>
</PathFigure>
</PathFigureCollection>
</PathGeometry.Figures>
</PathGeometry>
</Path.Data>
</Path>
</Grid>
Run Code Online (Sandbox Code Playgroud)
CircularProgressBar.cs:
public partial class CircularProgressBar : UserControl
{
public CircularProgressBar()
{
InitializeComponent();
Angle = (Percentage * 360) / 100;
RenderArc();
}
public int Radius
{
get { return (int)GetValue(RadiusProperty); }
set { SetValue(RadiusProperty, value); }
}
public Brush SegmentColor
{
get { return (Brush)GetValue(SegmentColorProperty); …
Run Code Online (Sandbox Code Playgroud) 我有WPF
申请ListView
和ProgressBar
内部.我定义这个颜色,Foreground
我的ProgressBar
:
在Windows 8
我可以看到这种颜色,但在Windows 7
我可以看到不同的颜色:
所以我的问题是有可能在所有操作系统中看到我的欲望颜色吗?
编辑:
这是我创建的风格:
<Style x:Key="CustomProgressBar" TargetType="ProgressBar" >
<Setter Property="Foreground" Value="#FF15669E"></Setter>
</Style>
Run Code Online (Sandbox Code Playgroud)
这是我的ProgressBar
:
<ProgressBar Name="prog" Maximum="100" Value="{Binding Progress}"
Width="{Binding Path=Width, ElementName=ProgressCell}" Background="#FFD3D0D0" Style="{StaticResource CustomProgressBar}"/>
Run Code Online (Sandbox Code Playgroud)
但颜色没有改变.
当我有几个(甚至一个)selected items
并且我click
在我的ListView
空空间(简单空格=不是行)上按简单时我想取消选择我所有选定的项目.
这是我取消选择所有项目功能:
private void DeselectAllListViewItems()
{
MyListView.SelectedItems.Clear();
}
Run Code Online (Sandbox Code Playgroud)
我尝试使用此函数获取所选索引:
private void MyListView_MouseDown(object sender, MouseButtonEventArgs e)
{
if (MyListView.SelectedIndex == -1)
DeselectAllListViewItems();
}
Run Code Online (Sandbox Code Playgroud)
但是如果我有几个选定的项目(或一个..),所选的索引永远不会是-1.那么我如何区分我的mouse click
空位而不是项目排?