c# - Interaction between xaml and xaml.cs files within same namespace -


 <window x:class="logf.circles"         xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"         xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"         title="circles" height="426" width="581" name="cir">     <grid background="beige">         <grid.resources>             <style x:key="myfirst">               <setter property="height" value="150" />                 <setter property="horizontalalignment" value="left"/>                 <setter property="margin" value="1"/>                 <setter property="width" value="150" />             </style>           </grid.resources>         <ellipse style="{staticresource myfirst}" fill="red"  name="ellipse1" stroke="black" verticalalignment="top" />         <ellipse style="{staticresource myfirst}" fill="orange"  name="ellipse2" stroke="black" verticalalignment="top" margin="1" horizontalalignment="center" />         <ellipse style="{staticresource myfirst}" fill="green"  name="ellipse3" stroke="black" verticalalignment="top" horizontalalignment="right"/>         <button content="replace" name="button1" tag="c_replace" tooltip="to replace color" margin="100" click="button1_click" horizontalalignment="stretch" verticalalignment="center" padding="20" horizontalcontentalignment="center" />     </grid>   </window> 

the above xaml code circles.xaml

i new wpf , wanted ask might silly. created xaml file , wanted use in mainwindow.xaml.cs file. ,i error saying

"the type or namespace name 'filename' not found (are missing using directive or assembly reference?)".

how interaction between .xaml , .xaml.cs file within same class. thanks.

in mainwindow.xaml.cs should run intializecompanent new xaml page created.

so running var mynewxamlwindow = new mynewxaml(); method in mainwindow.xaml.cs should call initialise code here @ make page available you

public mynewxaml() {     initializecomponent(); } 

for case replace mynewxaml circles


Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -