1 Ekim 2018 Pazartesi

javascript ile dropdown secimine göre alan gösterimi


@Html.DropDownList("optionId", new SelectList(SelectListData), "Select an option")

@Html.TextBox("controlId")
<script>
  $("#optionId").on("change", function () {
    if ($("#optionId option:selected").index() == 0) {
      $("#controlId").hide();
    } else {
      $("#controlId").show();
    }
  });
</script>

25 Temmuz 2018 Çarşamba

Devexpress WPF : loading decorator change content

<dx:LoadingDecorator Name="ld" SplashScreenDataContext="{Binding}">
    <dx:LoadingDecorator.SplashScreenTemplate>
        <DataTemplate>
            <dx:WaitIndicator DeferedVisibility="True" Content="{Binding SomeProperty}"/>
        </DataTemplate>
    </dx:LoadingDecorator.SplashScreenTemplate>
...

28 Mayıs 2018 Pazartesi

Işlem başka bir işlem tarafından kullanıldığından dosyasına erişemiyor Hatası ve Çözümü


using (System.IO.FileStream file = new System.IO.FileStream(path, System.IO.FileMode.OpenOrCreate, System.IO.FileAccess.ReadWrite, System.IO.FileShare.ReadWrite))
                    using (System.IO.StreamReader sr = new System.IO.StreamReader(file))
                    {
                        // Read the stream to a string, and write the string to the console.
                        string not = sr.ReadToEnd();
                    }

7 Aralık 2017 Perşembe

c# Uygulama bilgisayarda bir defa çalışması için kontrol




Control to prevent the application from opening twice;

Uygulamamızın Bilgisyarda aynı anda iki defa çalışmasını engellemek için :

foreach (var item in System.Diagnostics.Process.GetProcessesByName(System.Diagnostics.Process.GetCurrentProcess().ProcessName))
                {

                    if (item.Id != System.Diagnostics.Process.GetCurrentProcess().Id)
                    {
                        item.Kill();
                        item.Close();
                    }

                }

20 Eylül 2017 Çarşamba

WPF CodeBhind set Style

StyleLabel0 = (Style)System.Windows.Application.Current.Resources["dxLabelBaseStyle"]; 
     
StyleLabel1 = (Style)System.Windows.Application.Current.Resources["dxLabelBaseStyle"];

           

14 Eylül 2017 Perşembe

WPF DataTrigger Binding Visibility

 <dxlc:LayoutGroup Visibility="Collapsed"  >
         <dxlc:LayoutGroup.Style>
                <Style TargetType="dxlc:LayoutGroup">
                                            <Style.Triggers>
                                                <DataTrigger  Binding="{Binding ElementName=hesapTip,Path=SelectedItem.Alan}" Value="DEGER">
                                                    <Setter Property="Visibility" Value="Visible" />
                                                </DataTrigger>
                                            </Style.Triggers>
                                        </Style>
                                    </dxlc:LayoutGroup.Style>
</dxlc:LayoutGroup>

7 Haziran 2017 Çarşamba

DevExpress WPF GridControl: Adding a ComboBox to a column, binding it to a collection of the row's data

<dxg:GridColumn Header="bb" FieldName="Seviyesi"  ReadOnly="False"  >
       <dxg:GridColumn.EditTemplate>
              <ControlTemplate>
                     <dxe:ComboBoxEdit Name="PART_Editor"
                              HorizontalContentAlignment="Left"
                              ItemsSource="{Binding SelectedItem,
                             Converter={StaticResource  SeviyeComboConverter},
RelativeSource={RelativeSource Mode=FindAncestor,
      AncestorType={x:Type dxg:GridControl}}}"
                              DisplayMember="Name"
                              ValueMember="Code"
                              EditValue="{Binding EditValue,
                             RelativeSource={RelativeSource TemplatedParent}}"
                              IsTextEditable="True"
                              AllowNullInput="True"
                              AutoComplete="True"                            
                              ImmediatePopup="True"/>
                   </ControlTemplate>
              </dxg:GridColumn.EditTemplate>
       </dxg:GridColumn>


 public class SeviyeComboConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {


                int yetkiseviye = ShareDate.GlobalData.TanimList.First(f => f.Ekran_Id == ((ServisBaglanti.BackOfficeEkranRolServiceBaglanti.RefTRolEkranYetki)value).Ekran_Id).seviye;

                List<CodeName> liste = new List<CodeName>();

                for (int i = 0; yetkiseviye + 1 > i; i++)
                {
                    CodeName item = new CodeName { Code = i, Name =  "Seviye " + i };
                    liste.Add(item);

                }
                return liste;
         
        }

        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            if (value != null)
            {
                return value;
            }
            return null;
        }
    }




          <dxg:GridColumn Header="Company"  FieldName="SelectedCompanyId" Width="50" >
                        <dxg:GridColumn.CellTemplate>
                            <DataTemplate>
                                <dxe:ComboBoxEdit Name="PART_Editor"
                                                     ImmediatePopup="True"                                        
                                    ItemsSource="{Binding RowData.Row.Company}"
                                    IsTextEditable="False"
                                    ApplyItemTemplateToSelectedItem="False"
                                   ValueMember="IdCustomer" 
                                   DisplayMember="Name">
                                    <dxe:ComboBoxEdit.DisplayTemplate>
                                        <ControlTemplate>
                                            <TextBlock   Text="{Binding Path=DisplayText, RelativeSource={RelativeSource TemplatedParent}}"></TextBlock>
                                         </ControlTemplate>
                                    </dxe:ComboBoxEdit.DisplayTemplate>
                                </dxe:ComboBoxEdit>
                            </DataTemplate>
                        </dxg:GridColumn.CellTemplate>
                    </dxg:GridColumn>



                <dxg:GridColumn FieldName="TypeName">
                    <dxg:GridColumn.EditTemplate>
                        <ControlTemplate>
                            <dxe:ComboBoxEdit x:Name="PART_Editor" EditMode="InplaceActive"
                                              EditValue="{Binding EditValue, RelativeSource={RelativeSource Mode=TemplatedParent}, 
                                                            Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                                              ItemsSource="{Binding RowData.Row.Types}"
                                              ValueMember="FullName" DisplayMember="FullName">
                            </dxe:ComboBoxEdit>
                        </ControlTemplate>
                    </dxg:GridColumn.EditTemplate>
                </dxg:GridColumn>