C#
7
Вклад в тег
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<probing privatePath="Modules"/>
</assemblyBinding>
</runtime>
<Window.Resources>
<!--шаблон кнопки-->
<ControlTemplate x:Key="buttonTemplate1" TargetType="{x:Type Button}">
<Border Name="border" BorderBrush="Black" BorderThickness="1" CornerRadius="0" Background="Red" TextBlock.Foreground="Black">
<Grid>
<Rectangle Name="focusCue" Visibility="Hidden" Stroke="Black" StrokeThickness="1" StrokeDashArray="1 2" SnapsToDevicePixels="True"></Rectangle>
<ContentPresenter Margin="{TemplateBinding Padding}" HorizontalAlignment="Center" RecognizesAccessKey="True"></ContentPresenter>
</Grid>
</Border>
<ControlTemplate.Triggers>
<EventTrigger RoutedEvent="MouseEnter">
<BeginStoryboard>
<Storyboard>
<ColorAnimation Storyboard.TargetName="border" Storyboard.TargetProperty="Background.Color" To="Purple" >
</ColorAnimation>
</Storyboard>
</BeginStoryboard>
</EventTrigger>
<EventTrigger RoutedEvent="MouseLeave">
<BeginStoryboard>
<Storyboard>
<ColorAnimation Storyboard.TargetName="border" Storyboard.TargetProperty="Background.Color" >
</ColorAnimation>
</Storyboard>
</BeginStoryboard>
</EventTrigger>
<Trigger Property="IsPressed" Value="true">
<Setter TargetName="border" Property="Background" Value="IndianRed"></Setter>
<Setter TargetName="border" Property="BorderBrush" Value="DarkKhaki"></Setter>
</Trigger>
<Trigger Property="IsFocused" Value="true">
<Setter TargetName="focusCue" Property="Visibility" Value="Visible"></Setter>
</Trigger>
<Trigger Property="IsEnabled" Value="false">
<Setter TargetName="border" Property="TextBlock.Foreground" Value="Gray"></Setter>
<Setter TargetName="border" Property="Background" Value="MistyRose"></Setter>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
<Style x:Key="newButtonStyle" TargetType="Button">
<Setter Property="Control.Template" Value="{StaticResource buttonTemplate1}"></Setter>
</Style>
</Window.Resources>
<StackPanel>
<Button Height="30" Width="100" Margin="10" Style="{StaticResource newButtonStyle}">
</Button>
</StackPanel>
var yourObject=DGPrinterViev.SelectedItem as <ваш тип>;
if(yourObject!=null)
{
int id=yourObject.SeriyNomerPrinter;//либо как называется нужное свойство
}
string res=Properties.Resources.Data_XMLFile;
XmlReader xml2 = XmlReader.Create(new StringReader(res));
Uri uri = new Uri("pack://application:,,,/Resources/Data_XMLFile.xml", UriKind.Absolute);
StreamResourceInfo info = Application.GetResourceStream(uri);
XmlReader xml = XmlReader.Create(info.Stream);