Quantcast
Channel: Windows Presentation Foundation (WPF) forum
Viewing all articles
Browse latest Browse all 18858

Using resource dictionary from xaml

$
0
0

HI ,

Im using the following code in User control which applied to text boxes I have two question

1. Since I use it in the user control all the text boxes in the user control have the same behavior ,

if for example I have one text box that don't have this behavior (For example I dont want that the PreviewDragEnter  will be applied to this text box ),how should i do that?

2. Currently I use this code in the user control and I want to call to this text box in the xaml from the resource dictionary

how should i get this style in the user control from the resource dictionary ?

Thanks,

Miley

   <Grid.Resources>

            <Style TargetType="TextBox">
                <Setter Property="AcceptsReturn" Value="True"/>
                <Setter Property="Height" Value="25"/>
                <Setter Property="Width" Value="150"/>
                <Setter Property="TextWrapping" Value="Wrap"/>
                <Setter Property="VerticalAlignment" Value="Top"/>
                <EventSetter Event="PreviewDragEnter"
                       Handler="DropText_PreviewDragEnter"/>

  </Style>

just using text box in the user control and for example the height is 25 .

<TextBox x:Name="Name" >



Viewing all articles
Browse latest Browse all 18858

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>